tastudio: make analog editing mode expandable along with selection
- apply the changes made using keys to all the analog edited cells - clamp displayed value if needed the same the resulting value is clamped
This commit is contained in:
parent
327606234f
commit
acbdfbcec9
|
@ -23,9 +23,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private bool _startSelectionDrag;
|
private bool _startSelectionDrag;
|
||||||
private bool _selectionDragState;
|
private bool _selectionDragState;
|
||||||
private bool _supressContextMenu;
|
private bool _supressContextMenu;
|
||||||
|
|
||||||
// SuuperW: For editing analog input
|
// SuuperW: For editing analog input
|
||||||
private string _floatEditColumn = string.Empty;
|
private string _floatEditColumn = string.Empty;
|
||||||
private int _floatEditRow = -1;
|
private int _floatEditRow = -1;
|
||||||
|
private string _floatTypedValue;
|
||||||
|
private int _floatEditYPos = -1;
|
||||||
private int floatEditRow
|
private int floatEditRow
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
|
@ -34,8 +37,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
TasView.suspendHotkeys = FloatEditingMode;
|
TasView.suspendHotkeys = FloatEditingMode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private string _floatTypedValue;
|
public bool FloatEditingMode
|
||||||
private int _floatEditYPos = -1;
|
{
|
||||||
|
get { return _floatEditRow != -1; }
|
||||||
|
}
|
||||||
|
private List<int> _extraFloatRows = new List<int>();
|
||||||
|
|
||||||
// Right-click dragging
|
// Right-click dragging
|
||||||
private string[] _rightClickInput = null;
|
private string[] _rightClickInput = null;
|
||||||
private string[] _rightClickOverInput = null;
|
private string[] _rightClickOverInput = null;
|
||||||
|
@ -45,10 +52,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private bool _leftButtonHeld = false;
|
private bool _leftButtonHeld = false;
|
||||||
private bool mouseButtonHeld
|
private bool mouseButtonHeld
|
||||||
{
|
{
|
||||||
get
|
get { return _rightClickFrame != -1 || _leftButtonHeld; }
|
||||||
{
|
|
||||||
return _rightClickFrame != -1 || _leftButtonHeld;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _triggerAutoRestore; // If true, autorestore will be called on mouse up
|
private bool _triggerAutoRestore; // If true, autorestore will be called on mouse up
|
||||||
|
@ -57,6 +61,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private int? _seekStartFrame = null;
|
private int? _seekStartFrame = null;
|
||||||
private bool _wasRecording = false;
|
private bool _wasRecording = false;
|
||||||
|
|
||||||
|
private Emulation.Common.ControllerDefinition controllerType
|
||||||
|
{ get { return Global.MovieSession.MovieControllerAdapter.Type; } }
|
||||||
|
|
||||||
|
public AutoPatternBool[] BoolPatterns;
|
||||||
|
public AutoPatternFloat[] FloatPatterns;
|
||||||
|
|
||||||
private void JumpToGreenzone()
|
private void JumpToGreenzone()
|
||||||
{
|
{
|
||||||
if (Global.Emulator.Frame > CurrentTasMovie.LastValidFrame)
|
if (Global.Emulator.Frame > CurrentTasMovie.LastValidFrame)
|
||||||
|
@ -100,36 +110,25 @@ namespace BizHawk.Client.EmuHawk
|
||||||
RefreshDialog();
|
RefreshDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool FloatEditingMode
|
#region Query callbacks
|
||||||
{
|
|
||||||
get { return _floatEditRow != -1; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// public static Color CurrentFrame_FrameCol = Color.FromArgb(0xCFEDFC); Why?
|
// public static Color CurrentFrame_FrameCol = Color.FromArgb(0xCFEDFC); Why?
|
||||||
public static Color CurrentFrame_InputLog = Color.FromArgb(0x00B5E7F7);
|
public static Color CurrentFrame_InputLog = Color.FromArgb(0x00B5E7F7);
|
||||||
public static Color SeekFrame_InputLog = Color.FromArgb(0x70B5E7F7);
|
public static Color SeekFrame_InputLog = Color.FromArgb(0x70B5E7F7);
|
||||||
|
|
||||||
public static Color GreenZone_FrameCol = Color.FromArgb(0xDDFFDD);
|
public static Color GreenZone_FrameCol = Color.FromArgb(0xDDFFDD);
|
||||||
public static Color GreenZone_InputLog = Color.FromArgb(0xD2F9D3);
|
public static Color GreenZone_InputLog = Color.FromArgb(0xD2F9D3);
|
||||||
public static Color GreenZone_InputLog_Stated = Color.FromArgb(0xC4F7C8);
|
public static Color GreenZone_InputLog_Stated = Color.FromArgb(0xC4F7C8);
|
||||||
public static Color GreenZone_InputLog_Invalidated = Color.FromArgb(0xE0FBE0);
|
public static Color GreenZone_InputLog_Invalidated = Color.FromArgb(0xE0FBE0);
|
||||||
|
|
||||||
public static Color LagZone_FrameCol = Color.FromArgb(0xFFDCDD);
|
public static Color LagZone_FrameCol = Color.FromArgb(0xFFDCDD);
|
||||||
public static Color LagZone_InputLog = Color.FromArgb(0xF4DADA);
|
public static Color LagZone_InputLog = Color.FromArgb(0xF4DADA);
|
||||||
public static Color LagZone_InputLog_Stated = Color.FromArgb(0xF0D0D2);
|
public static Color LagZone_InputLog_Stated = Color.FromArgb(0xF0D0D2);
|
||||||
public static Color LagZone_InputLog_Invalidated = Color.FromArgb(0xF7E5E5);
|
public static Color LagZone_InputLog_Invalidated = Color.FromArgb(0xF7E5E5);
|
||||||
|
|
||||||
public static Color Marker_FrameCol = Color.FromArgb(0xF7FFC9);
|
public static Color Marker_FrameCol = Color.FromArgb(0xF7FFC9);
|
||||||
public static Color AnalogEdit_Col = Color.FromArgb(0x909070); // SuuperW: When editing an analog value, it will be a gray color.
|
public static Color AnalogEdit_Col = Color.FromArgb(0x909070); // SuuperW: When editing an analog value, it will be a gray color.
|
||||||
|
|
||||||
private Emulation.Common.ControllerDefinition controllerType
|
|
||||||
{ get { return Global.MovieSession.MovieControllerAdapter.Type; } }
|
|
||||||
|
|
||||||
public AutoPatternBool[] BoolPatterns;
|
|
||||||
public AutoPatternFloat[] FloatPatterns;
|
|
||||||
|
|
||||||
#region Query callbacks
|
|
||||||
|
|
||||||
private Bitmap ts_v_arrow_green_blue = Properties.Resources.ts_v_arrow_green_blue;
|
private Bitmap ts_v_arrow_green_blue = Properties.Resources.ts_v_arrow_green_blue;
|
||||||
private Bitmap ts_h_arrow_green_blue = Properties.Resources.ts_h_arrow_green_blue;
|
private Bitmap ts_h_arrow_green_blue = Properties.Resources.ts_h_arrow_green_blue;
|
||||||
private Bitmap ts_v_arrow_blue = Properties.Resources.ts_v_arrow_blue;
|
private Bitmap ts_v_arrow_blue = Properties.Resources.ts_v_arrow_blue;
|
||||||
|
@ -214,7 +213,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
else
|
else
|
||||||
color = Color.FromArgb(0x60FFFFFF);
|
color = Color.FromArgb(0x60FFFFFF);
|
||||||
}
|
}
|
||||||
else if (index == _floatEditRow && columnName == _floatEditColumn)
|
else if (FloatEditingMode &&
|
||||||
|
(index == _floatEditRow || _extraFloatRows.Contains(index)) &&
|
||||||
|
columnName == _floatEditColumn)
|
||||||
{ // SuuperW: Analog editing is indicated by a color change.
|
{ // SuuperW: Analog editing is indicated by a color change.
|
||||||
color = AnalogEdit_Col;
|
color = AnalogEdit_Col;
|
||||||
}
|
}
|
||||||
|
@ -438,15 +439,31 @@ namespace BizHawk.Client.EmuHawk
|
||||||
bool wasHeld = _leftButtonHeld;
|
bool wasHeld = _leftButtonHeld;
|
||||||
_leftButtonHeld = true;
|
_leftButtonHeld = true;
|
||||||
// SuuperW: Exit float editing mode, or re-enter mouse editing
|
// SuuperW: Exit float editing mode, or re-enter mouse editing
|
||||||
if (_floatEditRow != -1)
|
if (FloatEditingMode)
|
||||||
{
|
{
|
||||||
if (_floatEditColumn != buttonName || _floatEditRow != frame)
|
if (Control.ModifierKeys == Keys.Control || Control.ModifierKeys == Keys.Shift)
|
||||||
{
|
{
|
||||||
|
_extraFloatRows.Clear();
|
||||||
|
_extraFloatRows.AddRange(TasView.SelectedRows);
|
||||||
|
_startSelectionDrag = true;
|
||||||
|
_selectionDragState = TasView.SelectedRows.Contains(frame);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (_floatEditColumn != buttonName ||
|
||||||
|
!(_floatEditRow == frame || _extraFloatRows.Contains(frame)))
|
||||||
|
{
|
||||||
|
_extraFloatRows.Clear();
|
||||||
floatEditRow = -1;
|
floatEditRow = -1;
|
||||||
RefreshTasView();
|
RefreshTasView();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (_extraFloatRows.Contains(frame))
|
||||||
|
{
|
||||||
|
_extraFloatRows.Clear();
|
||||||
|
floatEditRow = frame;
|
||||||
|
RefreshTasView();
|
||||||
|
}
|
||||||
_floatEditYPos = e.Y;
|
_floatEditYPos = e.Y;
|
||||||
_floatPaintState = CurrentTasMovie.GetFloatState(frame, buttonName);
|
_floatPaintState = CurrentTasMovie.GetFloatState(frame, buttonName);
|
||||||
_triggerAutoRestore = true;
|
_triggerAutoRestore = true;
|
||||||
|
@ -622,7 +639,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_startFloatDrawColumn = string.Empty;
|
_startFloatDrawColumn = string.Empty;
|
||||||
TasView.ReleaseCurrentCell();
|
TasView.ReleaseCurrentCell();
|
||||||
// Exit float editing if value was changed with cursor
|
// Exit float editing if value was changed with cursor
|
||||||
if (_floatEditRow != -1 && _floatPaintState != CurrentTasMovie.GetFloatState(_floatEditRow, _floatEditColumn))
|
if (FloatEditingMode && _floatPaintState != CurrentTasMovie.GetFloatState(_floatEditRow, _floatEditColumn))
|
||||||
{
|
{
|
||||||
floatEditRow = -1;
|
floatEditRow = -1;
|
||||||
_triggerAutoRestore = true;
|
_triggerAutoRestore = true;
|
||||||
|
@ -634,7 +651,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_floatEditYPos = -1;
|
_floatEditYPos = -1;
|
||||||
_leftButtonHeld = false;
|
_leftButtonHeld = false;
|
||||||
|
|
||||||
if (_floatEditRow == -1 && CurrentTasMovie.ChangeLog != null)
|
if (!FloatEditingMode && CurrentTasMovie.ChangeLog != null)
|
||||||
{
|
{
|
||||||
CurrentTasMovie.ChangeLog.EndBatch();
|
CurrentTasMovie.ChangeLog.EndBatch();
|
||||||
}
|
}
|
||||||
|
@ -659,7 +676,13 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
else if (e.Button == MouseButtons.Left)
|
else if (e.Button == MouseButtons.Left)
|
||||||
{
|
{
|
||||||
ClearLeftMouseStates();
|
if (FloatEditingMode && (Control.ModifierKeys == Keys.Control || Control.ModifierKeys == Keys.Shift))
|
||||||
|
{
|
||||||
|
_leftButtonHeld = false;
|
||||||
|
_startSelectionDrag = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ClearLeftMouseStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.Button == System.Windows.Forms.MouseButtons.Right)
|
if (e.Button == System.Windows.Forms.MouseButtons.Right)
|
||||||
|
@ -716,7 +739,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (TasView.CurrentCell.RowIndex.HasValue &&
|
if (TasView.CurrentCell.RowIndex.HasValue &&
|
||||||
buttonName == FrameColumnName &&
|
buttonName == FrameColumnName &&
|
||||||
_floatEditRow == -1)
|
!FloatEditingMode)
|
||||||
{
|
{
|
||||||
if (Settings.EmptyMarkers)
|
if (Settings.EmptyMarkers)
|
||||||
{
|
{
|
||||||
|
@ -774,6 +797,13 @@ namespace BizHawk.Client.EmuHawk
|
||||||
for (var i = startVal; i <= endVal; i++)
|
for (var i = startVal; i <= endVal; i++)
|
||||||
{
|
{
|
||||||
TasView.SelectRow(i, _selectionDragState);
|
TasView.SelectRow(i, _selectionDragState);
|
||||||
|
if (FloatEditingMode && (Control.ModifierKeys == Keys.Control || Control.ModifierKeys == Keys.Shift))
|
||||||
|
{
|
||||||
|
if (_selectionDragState)
|
||||||
|
_extraFloatRows.Add(i);
|
||||||
|
else
|
||||||
|
_extraFloatRows.Remove(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SetSplicer();
|
SetSplicer();
|
||||||
}
|
}
|
||||||
|
@ -976,7 +1006,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
// SuuperW: Float Editing
|
// SuuperW: Float Editing
|
||||||
if (_floatEditRow != -1)
|
if (FloatEditingMode)
|
||||||
{
|
{
|
||||||
float value = CurrentTasMovie.GetFloatState(_floatEditRow, _floatEditColumn);
|
float value = CurrentTasMovie.GetFloatState(_floatEditRow, _floatEditColumn);
|
||||||
float prev = value;
|
float prev = value;
|
||||||
|
@ -1011,9 +1041,15 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.KeyCode == Keys.Right)
|
if (e.KeyCode == Keys.Right)
|
||||||
|
{
|
||||||
value = rMax;
|
value = rMax;
|
||||||
|
_floatTypedValue = value.ToString();
|
||||||
|
}
|
||||||
else if (e.KeyCode == Keys.Left)
|
else if (e.KeyCode == Keys.Left)
|
||||||
|
{
|
||||||
value = rMin;
|
value = rMin;
|
||||||
|
_floatTypedValue = value.ToString();
|
||||||
|
}
|
||||||
else if (e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9)
|
else if (e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9)
|
||||||
{
|
{
|
||||||
if (curDigits >= maxDigits)
|
if (curDigits >= maxDigits)
|
||||||
|
@ -1080,7 +1116,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_floatTypedValue = value.ToString();
|
_floatTypedValue = value.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_floatEditRow == -1)
|
if (!FloatEditingMode)
|
||||||
CurrentTasMovie.ChangeLog.EndBatch();
|
CurrentTasMovie.ChangeLog.EndBatch();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1100,9 +1136,19 @@ namespace BizHawk.Client.EmuHawk
|
||||||
value = rMax;
|
value = rMax;
|
||||||
else if (value < rMin)
|
else if (value < rMin)
|
||||||
value = rMin;
|
value = rMin;
|
||||||
|
_floatTypedValue = value.ToString();
|
||||||
CurrentTasMovie.SetFloatState(_floatEditRow, _floatEditColumn, value);
|
CurrentTasMovie.SetFloatState(_floatEditRow, _floatEditColumn, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_extraFloatRows.Any())
|
||||||
|
{
|
||||||
|
foreach (int row in _extraFloatRows)
|
||||||
|
{
|
||||||
|
CurrentTasMovie.SetFloatState(row, _floatEditColumn, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (value != prev) // Auto-restore
|
if (value != prev) // Auto-restore
|
||||||
{
|
{
|
||||||
_triggerAutoRestore = true;
|
_triggerAutoRestore = true;
|
||||||
|
|
Loading…
Reference in New Issue