mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 14:44:24 +00:00
Visual tweaks for texttrash editor
Border around flowlayoutpanels Grow size of flowlayoutpanel if it is the only one being shown misc textbox length fixes
This commit is contained in:
parent
ef0348f341
commit
5d4e36ca9e
11 changed files with 91 additions and 88 deletions
78
PKHeX.WinForms/Subforms/PKM Editors/Text.Designer.cs
generated
78
PKHeX.WinForms/Subforms/PKM Editors/Text.Designer.cs
generated
|
@ -38,18 +38,19 @@
|
|||
this.CB_Language = new System.Windows.Forms.ComboBox();
|
||||
this.B_ApplyTrash = new System.Windows.Forms.Button();
|
||||
this.GB_Trash = new System.Windows.Forms.GroupBox();
|
||||
this.B_ClearTrash = new System.Windows.Forms.Button();
|
||||
this.L_Generation = new System.Windows.Forms.Label();
|
||||
this.NUD_Generation = new System.Windows.Forms.NumericUpDown();
|
||||
this.L_Language = new System.Windows.Forms.Label();
|
||||
this.L_Species = new System.Windows.Forms.Label();
|
||||
this.NUD_Generation = new System.Windows.Forms.NumericUpDown();
|
||||
this.L_Generation = new System.Windows.Forms.Label();
|
||||
this.B_ClearTrash = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.GB_Trash.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Generation)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// TB_Text
|
||||
//
|
||||
this.TB_Text.Location = new System.Drawing.Point(76, 12);
|
||||
this.TB_Text.Location = new System.Drawing.Point(92, 12);
|
||||
this.TB_Text.Name = "TB_Text";
|
||||
this.TB_Text.Size = new System.Drawing.Size(136, 20);
|
||||
this.TB_Text.TabIndex = 35;
|
||||
|
@ -90,6 +91,7 @@
|
|||
this.FLP_Characters.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.FLP_Characters.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.FLP_Characters.Location = new System.Drawing.Point(12, 126);
|
||||
this.FLP_Characters.Name = "FLP_Characters";
|
||||
this.FLP_Characters.Size = new System.Drawing.Size(305, 82);
|
||||
|
@ -100,6 +102,7 @@
|
|||
this.FLP_Hex.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.FLP_Hex.AutoScroll = true;
|
||||
this.FLP_Hex.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.FLP_Hex.Location = new System.Drawing.Point(12, 38);
|
||||
this.FLP_Hex.Name = "FLP_Hex";
|
||||
this.FLP_Hex.Size = new System.Drawing.Size(305, 82);
|
||||
|
@ -148,6 +151,36 @@
|
|||
this.GB_Trash.Text = "Trash Byte Layers";
|
||||
this.GB_Trash.Visible = false;
|
||||
//
|
||||
// B_ClearTrash
|
||||
//
|
||||
this.B_ClearTrash.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.B_ClearTrash.Location = new System.Drawing.Point(6, 100);
|
||||
this.B_ClearTrash.Name = "B_ClearTrash";
|
||||
this.B_ClearTrash.Size = new System.Drawing.Size(156, 23);
|
||||
this.B_ClearTrash.TabIndex = 47;
|
||||
this.B_ClearTrash.Text = "Clear Trash";
|
||||
this.B_ClearTrash.UseVisualStyleBackColor = true;
|
||||
this.B_ClearTrash.Click += new System.EventHandler(this.B_ClearTrash_Click);
|
||||
//
|
||||
// L_Generation
|
||||
//
|
||||
this.L_Generation.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.L_Generation.Location = new System.Drawing.Point(6, 67);
|
||||
this.L_Generation.Name = "L_Generation";
|
||||
this.L_Generation.Size = new System.Drawing.Size(103, 23);
|
||||
this.L_Generation.TabIndex = 46;
|
||||
this.L_Generation.Text = "Generation";
|
||||
this.L_Generation.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// NUD_Generation
|
||||
//
|
||||
this.NUD_Generation.Location = new System.Drawing.Point(115, 70);
|
||||
this.NUD_Generation.Name = "NUD_Generation";
|
||||
this.NUD_Generation.Size = new System.Drawing.Size(47, 20);
|
||||
this.NUD_Generation.TabIndex = 45;
|
||||
//
|
||||
// L_Language
|
||||
//
|
||||
this.L_Language.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
|
@ -170,41 +203,23 @@
|
|||
this.L_Species.Text = "Species";
|
||||
this.L_Species.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// NUD_Generation
|
||||
// label1
|
||||
//
|
||||
this.NUD_Generation.Location = new System.Drawing.Point(115, 70);
|
||||
this.NUD_Generation.Name = "NUD_Generation";
|
||||
this.NUD_Generation.Size = new System.Drawing.Size(47, 20);
|
||||
this.NUD_Generation.TabIndex = 45;
|
||||
//
|
||||
// L_Generation
|
||||
//
|
||||
this.L_Generation.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.L_Generation.Location = new System.Drawing.Point(6, 67);
|
||||
this.L_Generation.Name = "L_Generation";
|
||||
this.L_Generation.Size = new System.Drawing.Size(103, 23);
|
||||
this.L_Generation.TabIndex = 46;
|
||||
this.L_Generation.Text = "Generation";
|
||||
this.L_Generation.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// B_ClearTrash
|
||||
//
|
||||
this.B_ClearTrash.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.B_ClearTrash.Location = new System.Drawing.Point(6, 100);
|
||||
this.B_ClearTrash.Name = "B_ClearTrash";
|
||||
this.B_ClearTrash.Size = new System.Drawing.Size(156, 23);
|
||||
this.B_ClearTrash.TabIndex = 47;
|
||||
this.B_ClearTrash.Text = "Clear Trash";
|
||||
this.B_ClearTrash.UseVisualStyleBackColor = true;
|
||||
this.B_ClearTrash.Click += new System.EventHandler(this.B_ClearTrash_Click);
|
||||
this.label1.Location = new System.Drawing.Point(9, 9);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(77, 23);
|
||||
this.label1.TabIndex = 44;
|
||||
this.label1.Text = "String";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// f2_Text
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(503, 219);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.GB_Trash);
|
||||
this.Controls.Add(this.FLP_Hex);
|
||||
this.Controls.Add(this.FLP_Characters);
|
||||
|
@ -240,5 +255,6 @@
|
|||
private System.Windows.Forms.NumericUpDown NUD_Generation;
|
||||
private System.Windows.Forms.Label L_Generation;
|
||||
private System.Windows.Forms.Button B_ClearTrash;
|
||||
private System.Windows.Forms.Label label1;
|
||||
}
|
||||
}
|
|
@ -26,6 +26,17 @@ namespace PKHeX.WinForms
|
|||
TB_Text.Text = TB_NN.Text;
|
||||
TB_Text.Font = pkxFont;
|
||||
|
||||
if (FLP_Characters.Controls.Count == 0)
|
||||
{
|
||||
FLP_Characters.Visible = false;
|
||||
FLP_Hex.Height *= 2;
|
||||
}
|
||||
else if (FLP_Hex.Controls.Count == 0)
|
||||
{
|
||||
FLP_Characters.Location = FLP_Hex.Location;
|
||||
FLP_Characters.Height *= 2;
|
||||
}
|
||||
|
||||
editing = false;
|
||||
CenterToParent();
|
||||
}
|
||||
|
@ -80,7 +91,7 @@ namespace PKHeX.WinForms
|
|||
{
|
||||
switch (ModifierKeys)
|
||||
{
|
||||
case Keys.Control: n.Value = n.Maximum; break;
|
||||
case Keys.Shift: n.Value = n.Maximum; break;
|
||||
case Keys.Alt: n.Value = n.Minimum; break;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -60,10 +60,10 @@ namespace PKHeX.Core
|
|||
}
|
||||
public override string CardTitle
|
||||
{
|
||||
get { return PKX.array2strG4(Data, 0x104, 0x48); }
|
||||
get { return PKX.getString4(Data, 0x104, 0x48); }
|
||||
set
|
||||
{
|
||||
byte[] data = PKX.str2arrayG4(value);
|
||||
byte[] data = PKX.setString4(value, 0x48/2-1, 0x48/2, 0xFFFF);
|
||||
int len = data.Length;
|
||||
Array.Resize(ref data, 0x48);
|
||||
for (int i = 0; i < len; i++)
|
||||
|
|
|
@ -29,7 +29,8 @@ namespace PKHeX.Core
|
|||
|
||||
// Trash Bytes
|
||||
public override byte[] Nickname_Trash { get { return getData(0x48, 22); } set { if (value?.Length == 22) value.CopyTo(Data, 0x48); } }
|
||||
public override byte[] OT_Trash { get { return getData(0x68, 16); } set { if (value?.Length == 16) value.CopyTo(Data, 0x68); } }
|
||||
public override byte[] OT_Trash { get { return getData(0x68, 16); }
|
||||
set { if (value?.Length == 16) value.CopyTo(Data, 0x68); } }
|
||||
|
||||
// Future Attributes
|
||||
public override uint EncryptionConstant { get { return PID; } set { } }
|
||||
|
|
|
@ -1248,48 +1248,7 @@ namespace PKHeX.Core
|
|||
int index = Array.IndexOf(G4Chars, chr);
|
||||
return index > -1 ? G4Values[index] : (ushort)0xFFFF;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts Generation 4 Little Endian encoded character data to string.
|
||||
/// </summary>
|
||||
/// <param name="strdata">Byte array containing encoded character data.</param>
|
||||
/// <param name="offset">Offset to read from</param>
|
||||
/// <param name="count">Length of data to read.</param>
|
||||
/// <returns>Converted string.</returns>
|
||||
public static string array2strG4(byte[] strdata, int offset, int count)
|
||||
{
|
||||
string s = "";
|
||||
for (int i = 0; i < count; i += 2)
|
||||
{
|
||||
ushort val = BitConverter.ToUInt16(strdata, offset + i);
|
||||
if (val == 0xFFFF) break;
|
||||
ushort chr = val2charG4(val);
|
||||
if (chr == 0xFFFF) break;
|
||||
s += (char)chr;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a string to Generation 4 Little Endian encoded character data.
|
||||
/// </summary>
|
||||
/// <param name="str">String to be converted.</param>
|
||||
/// <returns>Byte array containing encoded character data</returns>
|
||||
public static byte[] str2arrayG4(string str)
|
||||
{
|
||||
byte[] strdata = new byte[str.Length * 2 + 2]; // +2 for 0xFFFF
|
||||
for (int i = 0; i < str.Length; i++)
|
||||
{
|
||||
ushort chr = str[i];
|
||||
ushort val = char2valG4(chr);
|
||||
if (val == 0xFFFF || chr == 0xFFFF)
|
||||
{ Array.Resize(ref strdata, i * 2); break; }
|
||||
BitConverter.GetBytes(val).CopyTo(strdata, i * 2);
|
||||
}
|
||||
BitConverter.GetBytes((ushort)0xFFFF).CopyTo(strdata, strdata.Length - 2);
|
||||
return strdata;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Converts Generation 4 Big Endian encoded character data to string.
|
||||
/// </summary>
|
||||
|
@ -2744,8 +2703,16 @@ namespace PKHeX.Core
|
|||
/// <returns>Decoded string.</returns>
|
||||
public static string getString4(byte[] data, int offset, int count)
|
||||
{
|
||||
string value = array2strG4(data, offset, count);
|
||||
return SanitizeString(value)
|
||||
StringBuilder s = new StringBuilder();
|
||||
for (int i = 0; i < count; i += 2)
|
||||
{
|
||||
ushort val = BitConverter.ToUInt16(data, offset + i);
|
||||
if (val == 0xFFFF) break;
|
||||
ushort chr = val2charG4(val);
|
||||
if (chr == 0xFFFF) break;
|
||||
s.Append((char)chr);
|
||||
}
|
||||
return s.ToString()
|
||||
.Replace("\uFF0D", "\u30FC") // Japanese chōonpu
|
||||
;
|
||||
}
|
||||
|
@ -2764,7 +2731,15 @@ namespace PKHeX.Core
|
|||
.Replace("\u30FC", "\uFF0D") // Japanese chōonpu
|
||||
.PadRight(value.Length + 1, (char)0xFFFF) // Null Terminator
|
||||
.PadRight(padTo, (char)padWith); // Padding
|
||||
return str2arrayG4(temp);
|
||||
|
||||
byte[] strdata = new byte[temp.Length * 2];
|
||||
for (int i = 0; i < temp.Length; i++)
|
||||
{
|
||||
ushort chr = temp[i];
|
||||
ushort val = char2valG4(chr);
|
||||
BitConverter.GetBytes(val).CopyTo(strdata, i * 2);
|
||||
}
|
||||
return strdata;
|
||||
}
|
||||
|
||||
/// <summary>Converts Generation 5 encoded data to decoded string.</summary>
|
||||
|
|
|
@ -155,7 +155,7 @@ namespace PKHeX.Core
|
|||
public override int MaxEV => 255;
|
||||
public override int Generation => 3;
|
||||
protected override int GiftCountMax => 1;
|
||||
public override int OTLength => 8;
|
||||
public override int OTLength => 7;
|
||||
public override int NickLength => 10;
|
||||
public override int MaxMoney => 999999;
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ namespace PKHeX.Core
|
|||
public override int MaxEV => 255;
|
||||
public override int Generation => 3;
|
||||
protected override int GiftCountMax => 1;
|
||||
public override int OTLength => 8;
|
||||
public override int OTLength => 7;
|
||||
public override int NickLength => 10;
|
||||
public override int MaxMoney => 999999;
|
||||
public override bool HasBoxWallpapers => false;
|
||||
|
|
|
@ -167,7 +167,7 @@ namespace PKHeX.Core
|
|||
public override int MaxEV => 255;
|
||||
public override int Generation => 3;
|
||||
protected override int GiftCountMax => 1;
|
||||
public override int OTLength => 8;
|
||||
public override int OTLength => 7;
|
||||
public override int NickLength => 10;
|
||||
public override int MaxMoney => 999999;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace PKHeX.Core
|
|||
protected override int EventFlagMax => int.MinValue;
|
||||
protected override int EventConstMax => int.MinValue;
|
||||
protected override int GiftCountMax => 11;
|
||||
public override int OTLength => 8;
|
||||
public override int OTLength => 7;
|
||||
public override int NickLength => 10;
|
||||
public override int MaxMoney => 999999;
|
||||
|
||||
|
@ -519,7 +519,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
int offset = getBoxOffset(BoxCount);
|
||||
if (Version == GameVersion.HGSS) offset += 0x8;
|
||||
return PKX.array2strG4(Data, offset + box*0x28, 0x28);
|
||||
return getString(offset + box*0x28, 0x28);
|
||||
}
|
||||
public override void setBoxName(int box, string value)
|
||||
{
|
||||
|
@ -527,7 +527,7 @@ namespace PKHeX.Core
|
|||
value = value.Substring(0, 13); // Hard cap
|
||||
int offset = getBoxOffset(BoxCount);
|
||||
if (Version == GameVersion.HGSS) offset += 0x8;
|
||||
setData(PKX.str2arrayG4(value), offset + box*0x28);
|
||||
setData(setString(value, 13), offset + box*0x28);
|
||||
}
|
||||
public override PKM getPKM(byte[] data)
|
||||
{
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace PKHeX.Core
|
|||
public override int MaxEV => 255;
|
||||
public override int Generation => 4;
|
||||
protected override int GiftCountMax => 1;
|
||||
public override int OTLength => 8;
|
||||
public override int OTLength => 7;
|
||||
public override int NickLength => 10;
|
||||
public override int MaxMoney => 999999;
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace PKHeX.Core
|
|||
public override int BoxCount => 24;
|
||||
public override int MaxEV => 255;
|
||||
public override int Generation => 5;
|
||||
public override int OTLength => 8;
|
||||
public override int OTLength => 7;
|
||||
public override int NickLength => 10;
|
||||
protected override int EventConstMax => 0x35E/2;
|
||||
protected override int GiftCountMax => 12;
|
||||
|
|
Loading…
Reference in a new issue