Hex Editor - fix Ctrl+C and Ctrl+A in the hex find box

This commit is contained in:
adelikat 2012-09-26 02:30:28 +00:00
parent f167551154
commit d5fc8f1c89
4 changed files with 33 additions and 19 deletions

View File

@ -28,7 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.FindBox = new System.Windows.Forms.TextBox();
this.FindBox = new BizHawk.HexTextBox();
this.Find_Prev = new System.Windows.Forms.Button();
this.Find_Next = new System.Windows.Forms.Button();
this.HexRadio = new System.Windows.Forms.RadioButton();
@ -37,13 +37,11 @@
//
// FindBox
//
this.FindBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.FindBox.Location = new System.Drawing.Point(13, 12);
this.FindBox.Name = "FindBox";
this.FindBox.Size = new System.Drawing.Size(156, 20);
this.FindBox.TabIndex = 0;
this.FindBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FindBox_KeyDown);
this.FindBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.FindBox_KeyPress);
//
// Find_Prev
//
@ -111,7 +109,7 @@
#endregion
private System.Windows.Forms.TextBox FindBox;
private HexTextBox FindBox;
private System.Windows.Forms.Button Find_Prev;
private System.Windows.Forms.Button Find_Next;
private System.Windows.Forms.RadioButton HexRadio;

View File

@ -74,21 +74,6 @@ namespace BizHawk.MultiClient
Global.MainForm.HexEditor1.FindNext(GetFindBoxChars());
}
private void FindBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (HexRadio.Checked)
{
if (e.KeyChar == '\b' || e.KeyChar == 22)
{
return;
}
else if (!InputValidate.IsValidHexNumber(e.KeyChar))
{
e.Handled = true;
}
}
}
private void ChangeCasing()
{
if (HexRadio.Checked)

View File

@ -110,6 +110,9 @@
<Compile Include="FolderBrowserDialogEx.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="HexTextBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="InputConfigBase.cs">
<SubType>Form</SubType>
</Compile>

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace BizHawk
{
public class HexTextBox : TextBox
{
public HexTextBox()
{
this.CharacterCasing = CharacterCasing.Upper;
}
protected override void OnKeyPress(KeyPressEventArgs e)
{
if (e.KeyChar == '\b' || e.KeyChar == 22 || e.KeyChar == 1 || e.KeyChar == 3)
{
return;
}
else if (!InputValidate.IsValidHexNumber(e.KeyChar))
{
e.Handled = true;
}
}
}
}