TAStudio: Fixed arrow keys not being picked up in KeyPress, plus minor edits/bugfixes to arrow key editing of float values.

This commit is contained in:
SuuperW 2015-02-24 20:55:24 +00:00
parent a4ce9de091
commit 734101a8fd
2 changed files with 18 additions and 6 deletions

View File

@ -781,6 +781,7 @@ namespace BizHawk.Client.EmuHawk
this.TasView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TasView_MouseDown);
this.TasView.MouseEnter += new System.EventHandler(this.TasView_MouseEnter);
this.TasView.MouseUp += new System.Windows.Forms.MouseEventHandler(this.TasView_MouseUp);
this.TasView.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.TasView_PreviewKeyDown);
//
// TasStatusStrip
//
@ -1050,7 +1051,7 @@ namespace BizHawk.Client.EmuHawk
this.MinimumSize = new System.Drawing.Size(437, 148);
this.Name = "TAStudio";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "TAStudio - Beta Release (use at your own risk)";
this.Text = "a";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Tastudio_Closing);
this.Load += new System.EventHandler(this.Tastudio_Load);
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.TAStudio_DragDrop);
@ -1176,5 +1177,6 @@ namespace BizHawk.Client.EmuHawk
private System.Windows.Forms.ToolStripMenuItem HideLagFrames0;
private System.Windows.Forms.ToolStripMenuItem HideLagFrames1;
private System.Windows.Forms.ToolStripMenuItem HideLagFrames2;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
}
}

View File

@ -497,15 +497,15 @@ namespace BizHawk.Client.EmuHawk
// Range for N64 Y axis has max -128 and min 127. That should probably be fixed elsewhere, but I'll put a quick fix here anyway.
float rMax = range.Max;
float rMin = range.Min;
if (rMax > rMin)
if (rMax < rMin)
{
rMax = range.Min;
rMin = range.Max;
}
if (e.KeyCode == Keys.Right) // No arrow key presses are being detected. Why?
value = range.Max;
if (e.KeyCode == Keys.Right)
value = rMax;
else if (e.KeyCode == Keys.Left)
value = range.Min;
value = rMin;
else if (e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9)
{
_floatTypedValue += e.KeyCode - Keys.D0;
@ -517,7 +517,7 @@ namespace BizHawk.Client.EmuHawk
value = Convert.ToSingle(_floatTypedValue);
}
else if (e.KeyCode == Keys.OemPeriod && !_floatTypedValue.Contains('.'))
{
{ // These aren't displayed in TasView, it rounds display. They ARE getting picked up properly, though.
if (_floatTypedValue == "")
_floatTypedValue = "0";
_floatTypedValue += ".";
@ -549,6 +549,8 @@ namespace BizHawk.Client.EmuHawk
if (e.Shift)
changeBy *= 10;
value += changeBy;
if (changeBy != 0)
_floatTypedValue = value.ToString();
}
if (_floatEditRow != -1 && value != CurrentTasMovie.GetFloatValue(_floatEditRow, _floatEditColumn))
@ -563,6 +565,14 @@ namespace BizHawk.Client.EmuHawk
TasView.Refresh();
}
/// <summary>
/// This allows arrow keys to be detected by KeyDown.
/// </summary>
private void TasView_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
e.IsInputKey = true;
}
#endregion
}
}