Hex Editor - add shift highlighting logic to up,down,left,right,pageup,pagedown keys, add multi-highlight logic to tab and shift+tab. Still todo: several other keys.
This commit is contained in:
parent
12e674973d
commit
0d40a40ea4
|
@ -1136,27 +1136,101 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
private void HexEditor_KeyDown(object sender, KeyEventArgs e)
|
private void HexEditor_KeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
|
int newHighlighted;
|
||||||
switch (e.KeyCode)
|
switch (e.KeyCode)
|
||||||
{
|
{
|
||||||
case Keys.Up:
|
case Keys.Up:
|
||||||
GoToAddress(addressHighlighted - 16);
|
newHighlighted = addressHighlighted - 16;
|
||||||
|
if (e.Modifiers == Keys.Shift)
|
||||||
|
{
|
||||||
|
for (int i = newHighlighted + 1; i <= addressHighlighted; i++)
|
||||||
|
{
|
||||||
|
AddToSecondaryHighlights(i);
|
||||||
|
}
|
||||||
|
GoToAddress(newHighlighted);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SecondaryHighlightedAddresses.Clear();
|
||||||
|
GoToAddress(newHighlighted);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Keys.Down:
|
case Keys.Down:
|
||||||
GoToAddress(addressHighlighted + 16);
|
newHighlighted = addressHighlighted + 16;
|
||||||
|
if (e.Modifiers == Keys.Shift)
|
||||||
|
{
|
||||||
|
for (int i = newHighlighted - 16; i < newHighlighted; i++)
|
||||||
|
{
|
||||||
|
AddToSecondaryHighlights(i);
|
||||||
|
}
|
||||||
|
GoToAddress(newHighlighted);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SecondaryHighlightedAddresses.Clear();
|
||||||
|
GoToAddress(newHighlighted);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Keys.Left:
|
case Keys.Left:
|
||||||
GoToAddress(addressHighlighted - (1 * DataSize));
|
newHighlighted = addressHighlighted - (1 * DataSize);
|
||||||
|
if (e.Modifiers == Keys.Shift)
|
||||||
|
{
|
||||||
|
AddToSecondaryHighlights(addressHighlighted);
|
||||||
|
GoToAddress(newHighlighted);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SecondaryHighlightedAddresses.Clear();
|
||||||
|
GoToAddress(newHighlighted);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Keys.Right:
|
case Keys.Right:
|
||||||
GoToAddress(addressHighlighted + (1 * DataSize));
|
newHighlighted = addressHighlighted + (1 * DataSize);
|
||||||
|
if (e.Modifiers == Keys.Shift)
|
||||||
|
{
|
||||||
|
AddToSecondaryHighlights(addressHighlighted);
|
||||||
|
GoToAddress(newHighlighted);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SecondaryHighlightedAddresses.Clear();
|
||||||
|
GoToAddress(newHighlighted);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Keys.PageUp:
|
case Keys.PageUp:
|
||||||
GoToAddress(addressHighlighted - (RowsVisible * 16));
|
newHighlighted = addressHighlighted - (RowsVisible * 16);
|
||||||
|
if (e.Modifiers == Keys.Shift)
|
||||||
|
{
|
||||||
|
for (int i = newHighlighted + 1; i <= addressHighlighted; i++)
|
||||||
|
{
|
||||||
|
AddToSecondaryHighlights(i);
|
||||||
|
}
|
||||||
|
GoToAddress(newHighlighted);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SecondaryHighlightedAddresses.Clear();
|
||||||
|
GoToAddress(newHighlighted);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Keys.PageDown:
|
case Keys.PageDown:
|
||||||
GoToAddress(addressHighlighted + (RowsVisible * 16));
|
newHighlighted = addressHighlighted + (RowsVisible * 16);
|
||||||
|
if (e.Modifiers == Keys.Shift)
|
||||||
|
{
|
||||||
|
for (int i = addressHighlighted + 1; i < newHighlighted; i++)
|
||||||
|
{
|
||||||
|
AddToSecondaryHighlights(i);
|
||||||
|
}
|
||||||
|
GoToAddress(newHighlighted);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SecondaryHighlightedAddresses.Clear();
|
||||||
|
GoToAddress(newHighlighted);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Keys.Tab:
|
case Keys.Tab:
|
||||||
|
SecondaryHighlightedAddresses.Clear();
|
||||||
if (e.Modifiers == Keys.Shift)
|
if (e.Modifiers == Keys.Shift)
|
||||||
GoToAddress(addressHighlighted - 8);
|
GoToAddress(addressHighlighted - 8);
|
||||||
else
|
else
|
||||||
|
@ -1192,6 +1266,14 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AddToSecondaryHighlights(int address)
|
||||||
|
{
|
||||||
|
if (address >= 0 && address < Domain.Size)
|
||||||
|
{
|
||||||
|
SecondaryHighlightedAddresses.Add(address);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void HexEditor_KeyUp(object sender, KeyEventArgs e)
|
private void HexEditor_KeyUp(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (!InputValidate.IsValidHexNumber(((char)e.KeyCode).ToString()))
|
if (!InputValidate.IsValidHexNumber(((char)e.KeyCode).ToString()))
|
||||||
|
|
Loading…
Reference in New Issue