2014-07-09 23:04:22 +00:00
using System ;
using System.Drawing ;
2014-07-28 16:43:47 +00:00
using System.Linq ;
2014-07-09 23:04:22 +00:00
using System.Windows.Forms ;
using BizHawk.Client.Common ;
namespace BizHawk.Client.EmuHawk
{
public partial class TAStudio
{
2014-07-11 16:08:47 +00:00
// Input Painting
2014-07-11 16:26:19 +00:00
private string _startBoolDrawColumn = string . Empty ;
private string _startFloatDrawColumn = string . Empty ;
2014-07-11 16:08:47 +00:00
private bool _boolPaintState ;
2014-07-11 16:26:19 +00:00
private float _floatPaintState ;
2014-07-11 16:08:47 +00:00
private bool _startMarkerDrag ;
private bool _startFrameDrag ;
2014-10-17 18:14:21 +00:00
private bool _supressContextMenu ;
2015-02-24 06:47:32 +00:00
// SuuperW: For editing analog input
private string _floatEditColumn = string . Empty ;
private int _floatEditRow = - 1 ;
private string _floatTypedValue ;
2015-02-24 19:00:12 +00:00
// SuuperW: Hiding lag frames (Mainly intended for 30fps play.)
private bool _hideLagFrames = true ; // This toggles if lag frames are hidden. For the number, see InputRoll.cs: _lagFramesToHide
// Frames that were lag frames, but are now past the greenzone are shown make editing awkward.
// (Showing such frames might be desireable in certain situations, such as when trying to eliminate a lone lag frame.)
2014-07-11 16:08:47 +00:00
2014-10-17 20:10:21 +00:00
private bool _triggerAutoRestore ; // If true, autorestore will be called on mouse up
private int? _triggerAutoRestoreFromFrame ; // If set and _triggerAutoRestore is true, will clal GoToFrameIfNecessary() with this value
2014-07-21 02:23:47 +00:00
public static Color CurrentFrame_FrameCol = Color . FromArgb ( 0xCFEDFC ) ;
public static Color CurrentFrame_InputLog = Color . FromArgb ( 0xB5E7F7 ) ;
2014-07-16 00:10:37 +00:00
2014-07-21 02:23:47 +00:00
public static Color GreenZone_FrameCol = Color . FromArgb ( 0xDDFFDD ) ;
2014-08-22 16:05:06 +00:00
public static Color GreenZone_Invalidated_FrameCol = Color . FromArgb ( 0xFFFFFF ) ;
2014-07-21 02:23:47 +00:00
public static Color GreenZone_InputLog = Color . FromArgb ( 0xC4F7C8 ) ;
2014-08-22 16:05:06 +00:00
public static Color GreenZone_Invalidated_InputLog = Color . FromArgb ( 0xE0FBE0 ) ;
2014-07-16 00:10:37 +00:00
2014-07-21 02:23:47 +00:00
public static Color LagZone_FrameCol = Color . FromArgb ( 0xFFDCDD ) ;
2014-08-22 16:05:06 +00:00
public static Color LagZone_Invalidated_FrameCol = Color . FromArgb ( 0xFFE9E9 ) ;
2014-07-21 02:23:47 +00:00
public static Color LagZone_InputLog = Color . FromArgb ( 0xF0D0D2 ) ;
2014-08-22 16:05:06 +00:00
public static Color LagZone_Invalidated_InputLog = Color . FromArgb ( 0xF7E5E5 ) ;
2014-07-16 00:10:37 +00:00
2014-07-21 02:23:47 +00:00
public static Color Marker_FrameCol = Color . FromArgb ( 0xF7FFC9 ) ;
2015-02-24 06:47:32 +00:00
public static Color AnalogEdit_Col = Color . FromArgb ( 0x909070 ) ; // SuuperW: When editing an analog value, it will be a gray color.
2014-07-16 00:10:37 +00:00
2014-07-09 23:04:22 +00:00
#region Query callbacks
2014-10-13 19:30:59 +00:00
private void TasView_QueryItemIcon ( int index , InputRoll . RollColumn column , ref Bitmap bitmap )
2014-09-03 03:16:16 +00:00
{
2014-10-13 19:30:59 +00:00
var columnName = column . Name ;
2014-09-03 03:16:16 +00:00
if ( columnName = = MarkerColumnName )
{
2014-12-14 01:20:19 +00:00
if ( index = = Emulator . Frame & & index = = GlobalWin . MainForm . PauseOnFrame )
2014-09-16 19:20:19 +00:00
{
2014-10-17 18:14:21 +00:00
bitmap = TasView . HorizontalOrientation ?
Properties . Resources . ts_v_arrow_green_blue :
Properties . Resources . ts_h_arrow_green_blue ;
2014-09-16 19:20:19 +00:00
}
2014-12-14 01:20:19 +00:00
else if ( index = = Emulator . Frame )
2014-09-03 03:16:16 +00:00
{
2014-10-17 18:14:21 +00:00
bitmap = TasView . HorizontalOrientation ?
Properties . Resources . ts_v_arrow_blue :
Properties . Resources . ts_h_arrow_blue ;
2014-09-03 03:16:16 +00:00
}
2014-09-16 19:20:19 +00:00
else if ( index = = GlobalWin . MainForm . PauseOnFrame )
{
2014-10-17 18:14:21 +00:00
bitmap = TasView . HorizontalOrientation ?
Properties . Resources . ts_v_arrow_green :
Properties . Resources . ts_h_arrow_green ;
2014-09-16 19:20:19 +00:00
}
2014-09-03 03:16:16 +00:00
}
}
2014-10-13 19:30:59 +00:00
private void TasView_QueryItemBkColor ( int index , InputRoll . RollColumn column , ref Color color )
2014-07-09 23:04:22 +00:00
{
2014-10-13 19:30:59 +00:00
var columnName = column . Name ;
2014-10-20 19:04:59 +00:00
var record = CurrentTasMovie [ index ] ;
2014-07-16 00:10:37 +00:00
if ( columnName = = MarkerColumnName )
2014-07-09 23:04:22 +00:00
{
2014-09-22 21:47:07 +00:00
if ( VersionInfo . DeveloperBuild ) // For debugging purposes, let's visually show the state frames
2014-07-16 23:04:56 +00:00
{
2014-09-22 21:47:07 +00:00
color = ( record . HasState ? color = Color . FromArgb ( 0xEEEEEE ) : Color . White ) ;
2014-07-16 23:04:56 +00:00
}
2015-02-24 03:06:57 +00:00
2014-07-16 23:04:56 +00:00
return ;
2014-07-09 23:04:22 +00:00
}
2014-07-16 23:04:56 +00:00
2015-02-24 06:47:32 +00:00
2014-07-16 23:04:56 +00:00
if ( columnName = = FrameColumnName )
2014-07-09 23:04:22 +00:00
{
2014-12-14 01:20:19 +00:00
if ( Emulator . Frame = = index )
2014-07-16 00:10:37 +00:00
{
color = CurrentFrame_FrameCol ;
}
2014-10-20 19:04:59 +00:00
else if ( CurrentTasMovie . Markers . IsMarker ( index ) )
2014-07-16 00:10:37 +00:00
{
color = Marker_FrameCol ;
}
else if ( record . Lagged . HasValue )
2014-07-10 19:24:21 +00:00
{
2014-10-17 18:14:21 +00:00
color = record . Lagged . Value ?
LagZone_FrameCol :
GreenZone_FrameCol ;
2014-07-10 19:24:21 +00:00
}
else
{
2014-07-16 00:10:37 +00:00
color = Color . White ;
}
}
else
{
2015-02-24 06:47:32 +00:00
// SuuperW: Analog editing is indicated by a color change.
if ( index = = _floatEditRow & & columnName = = _floatEditColumn )
{
color = AnalogEdit_Col ;
return ;
}
2014-12-14 01:20:19 +00:00
if ( Emulator . Frame = = index )
2014-07-16 00:10:37 +00:00
{
color = CurrentFrame_InputLog ;
}
else
{
if ( record . Lagged . HasValue )
{
2014-10-17 18:14:21 +00:00
color = record . Lagged . Value ?
LagZone_InputLog :
GreenZone_InputLog ;
2014-07-16 00:10:37 +00:00
}
else
{
2014-10-15 19:06:33 +00:00
color = Color . FromArgb ( 0xFFFEEE ) ;
2014-07-16 00:10:37 +00:00
}
2014-07-10 19:24:21 +00:00
}
2014-07-09 23:04:22 +00:00
}
}
2014-10-13 19:10:11 +00:00
private void TasView_QueryItemText ( int index , InputRoll . RollColumn column , out string text )
2014-07-09 23:04:22 +00:00
{
try
{
2014-07-16 23:04:56 +00:00
text = string . Empty ;
2014-10-13 19:10:11 +00:00
var columnName = column . Name ;
2014-07-09 23:04:22 +00:00
if ( columnName = = MarkerColumnName )
{
2014-09-18 00:51:16 +00:00
// Do nothing
2014-07-09 23:04:22 +00:00
}
else if ( columnName = = FrameColumnName )
{
2014-10-20 19:04:59 +00:00
text = ( index ) . ToString ( ) . PadLeft ( CurrentTasMovie . InputLogLength . ToString ( ) . Length , '0' ) ;
2014-07-09 23:04:22 +00:00
}
else
{
2014-10-20 19:04:59 +00:00
if ( index < CurrentTasMovie . InputLogLength )
2014-07-16 23:04:56 +00:00
{
2014-10-20 19:04:59 +00:00
text = CurrentTasMovie . DisplayValue ( index , columnName ) ;
2014-07-16 23:04:56 +00:00
}
2014-12-14 01:20:19 +00:00
else if ( Emulator . Frame = = CurrentTasMovie . InputLogLength ) // In this situation we have a "pending" frame for the user to click
2014-07-16 23:04:56 +00:00
{
2014-10-20 19:04:59 +00:00
text = CurrentTasMovie . CreateDisplayValueForButton (
2014-07-16 23:04:56 +00:00
Global . ClickyVirtualPadController ,
columnName ) ;
}
2014-07-09 23:04:22 +00:00
}
}
catch ( Exception ex )
{
text = string . Empty ;
MessageBox . Show ( "oops\n" + ex ) ;
}
}
2015-02-24 19:00:12 +00:00
// SuuperW: Used in InputRoll.cs to hide lag frames.
private bool TasView_QueryFrameLag ( int index )
{
return _hideLagFrames & & CurrentTasMovie [ index ] . Lagged . HasValue & & CurrentTasMovie [ index ] . Lagged . Value ;
}
2014-07-09 23:04:22 +00:00
#endregion
#region Events
2014-10-14 00:31:59 +00:00
private void TasView_ColumnClick ( object sender , InputRoll . ColumnClickEventArgs e )
2014-07-28 16:43:47 +00:00
{
2014-08-30 18:42:14 +00:00
if ( TasView . SelectedRows . Any ( ) )
2014-07-28 16:43:47 +00:00
{
2014-10-14 00:31:59 +00:00
var columnName = e . Column . Name ;
2014-07-28 16:43:47 +00:00
if ( columnName = = FrameColumnName )
{
2014-10-20 19:04:59 +00:00
CurrentTasMovie . Markers . Add ( TasView . LastSelectedIndex . Value , "" ) ;
2014-09-19 01:15:14 +00:00
RefreshDialog ( ) ;
2015-02-24 03:06:57 +00:00
2014-07-28 16:43:47 +00:00
}
else if ( columnName ! = MarkerColumnName ) // TODO: what about float?
{
2014-08-30 18:42:14 +00:00
foreach ( var index in TasView . SelectedRows )
2014-07-28 16:43:47 +00:00
{
ToggleBoolState ( index , columnName ) ;
2014-10-17 20:10:21 +00:00
_triggerAutoRestore = true ;
_triggerAutoRestoreFromFrame = TasView . SelectedRows . Min ( ) ;
2014-07-28 16:43:47 +00:00
}
RefreshDialog ( ) ;
}
}
}
2014-10-14 00:31:59 +00:00
private void TasView_ColumnRightClick ( object sender , InputRoll . ColumnClickEventArgs e )
2014-09-25 17:52:21 +00:00
{
2014-10-14 00:31:59 +00:00
e . Column . Emphasis ^ = true ;
2014-09-25 17:52:21 +00:00
2014-10-14 00:31:59 +00:00
Global . StickyXORAdapter . SetSticky ( e . Column . Name , e . Column . Emphasis ) ;
2014-09-25 18:12:18 +00:00
TasView . Refresh ( ) ;
2014-09-25 17:52:21 +00:00
}
2014-10-19 14:46:01 +00:00
private void TasView_ColumnReordered ( object sender , InputRoll . ColumnReorderedEventArgs e )
{
2014-10-20 19:04:59 +00:00
CurrentTasMovie . FlagChanges ( ) ;
2014-10-19 14:46:01 +00:00
}
2014-10-17 17:40:11 +00:00
private void TasView_MouseEnter ( object sender , EventArgs e )
{
TasView . Focus ( ) ;
}
2014-07-09 23:04:22 +00:00
private void TasView_MouseDown ( object sender , MouseEventArgs e )
{
2014-07-17 20:35:12 +00:00
if ( e . Button = = MouseButtons . Middle )
{
TogglePause ( ) ;
return ;
}
2015-02-24 06:47:32 +00:00
// SuuperW: Moved these.
if ( TasView . CurrentCell = = null | | ! TasView . CurrentCell . RowIndex . HasValue | | TasView . CurrentCell . Column = = null )
return ;
var frame = TasView . CurrentCell . RowIndex . Value ;
var buttonName = TasView . CurrentCell . Column . Name ;
// SuuperW: Exit float editing mode
if ( _floatEditColumn ! = buttonName | | _floatEditRow ! = frame )
{
_floatEditRow = - 1 ;
TasView . Refresh ( ) ;
}
if ( e . Button = = MouseButtons . Left )
2014-07-09 23:04:22 +00:00
{
2015-02-24 06:47:32 +00:00
if ( TasView . CurrentCell . Column . Name = = MarkerColumnName )
2014-07-09 23:04:22 +00:00
{
2015-02-24 06:47:32 +00:00
_startMarkerDrag = true ;
GoToFrame ( TasView . CurrentCell . RowIndex . Value ) ;
}
else if ( TasView . CurrentCell . Column . Name = = FrameColumnName )
{
_startFrameDrag = true ;
}
else // User changed input
{
if ( Global . MovieSession . MovieControllerAdapter . Type . BoolButtons . Contains ( buttonName ) )
2014-07-11 16:26:19 +00:00
{
2015-02-24 06:47:32 +00:00
ToggleBoolState ( TasView . CurrentCell . RowIndex . Value , buttonName ) ;
_triggerAutoRestore = true ;
_triggerAutoRestoreFromFrame = TasView . CurrentCell . RowIndex . Value ;
RefreshDialog ( ) ;
2014-07-14 01:49:37 +00:00
2015-02-24 06:47:32 +00:00
_startBoolDrawColumn = buttonName ;
2014-07-14 01:49:37 +00:00
2015-02-24 06:47:32 +00:00
if ( frame < CurrentTasMovie . InputLogLength )
{
_boolPaintState = CurrentTasMovie . BoolIsPressed ( frame , buttonName ) ;
}
else
{
_boolPaintState = Global . ClickyVirtualPadController . IsPressed ( buttonName ) ;
}
2014-09-18 21:56:13 +00:00
2015-02-24 06:47:32 +00:00
}
else
{
_startFloatDrawColumn = buttonName ;
2015-02-24 03:06:57 +00:00
2015-02-24 06:47:32 +00:00
if ( frame < CurrentTasMovie . InputLogLength )
{
_floatPaintState = CurrentTasMovie . GetFloatValue ( frame , buttonName ) ;
2014-07-14 01:49:37 +00:00
}
else
{
2015-02-24 06:47:32 +00:00
_floatPaintState = Global . ClickyVirtualPadController . GetFloat ( buttonName ) ;
2014-07-14 01:49:37 +00:00
}
2014-07-11 16:26:19 +00:00
}
2014-07-09 23:04:22 +00:00
}
}
}
private void TasView_MouseUp ( object sender , MouseEventArgs e )
{
2014-10-19 00:24:33 +00:00
if ( e . Button = = MouseButtons . Right & & ! TasView . IsPointingAtColumnHeader & & ! _supressContextMenu )
2014-10-15 22:52:23 +00:00
{
RightClickMenu . Show ( TasView , e . X , e . Y ) ;
}
else if ( e . Button = = MouseButtons . Left )
{
_startMarkerDrag = false ;
_startFrameDrag = false ;
_startBoolDrawColumn = string . Empty ;
_startFloatDrawColumn = string . Empty ;
_floatPaintState = 0 ;
}
_supressContextMenu = false ;
2014-10-17 20:10:21 +00:00
2014-10-21 01:31:41 +00:00
DoTriggeredAutoRestoreIfNeeded ( ) ;
2014-07-09 23:04:22 +00:00
}
2014-07-16 01:37:50 +00:00
private void TasView_MouseWheel ( object sender , MouseEventArgs e )
{
2014-08-23 13:14:25 +00:00
if ( TasView . RightButtonHeld & & TasView . CurrentCell . RowIndex . HasValue )
2014-07-16 01:37:50 +00:00
{
2014-10-15 22:52:23 +00:00
_supressContextMenu = true ;
2014-07-16 01:37:50 +00:00
if ( e . Delta < 0 )
{
2014-10-23 21:21:43 +00:00
GoToNextFrame ( ) ;
2014-07-16 01:37:50 +00:00
}
else
{
2014-10-23 21:21:43 +00:00
GoToPreviousFrame ( ) ;
2014-07-16 01:37:50 +00:00
}
}
}
private void TasView_MouseDoubleClick ( object sender , MouseEventArgs e )
{
2015-02-24 06:47:32 +00:00
if ( e . Button = = MouseButtons . Left )
2014-07-16 01:37:50 +00:00
{
2015-02-24 06:47:32 +00:00
var buttonName = TasView . CurrentCell . Column . Name ;
if ( TasView . CurrentCell . RowIndex . HasValue & &
buttonName = = FrameColumnName )
2014-10-15 16:09:14 +00:00
{
2015-02-24 06:47:32 +00:00
if ( Settings . EmptyMarkers )
{
CurrentTasMovie . Markers . Add ( TasView . CurrentCell . RowIndex . Value , string . Empty ) ;
RefreshDialog ( ) ;
}
else
{
CallAddMarkerPopUp ( TasView . CurrentCell . RowIndex . Value ) ;
}
2014-10-15 16:09:14 +00:00
}
2015-02-24 06:47:32 +00:00
else if ( Global . MovieSession . MovieControllerAdapter . Type . FloatControls . Contains ( buttonName ) )
{ // SuuperW: Edit float input
int frame = TasView . CurrentCell . RowIndex . Value ;
if ( _floatEditColumn = = buttonName & & _floatEditRow = = frame )
{
_floatEditRow = - 1 ;
RefreshDialog ( ) ;
}
else
{
_floatEditColumn = buttonName ;
_floatEditRow = frame ;
_floatTypedValue = "" ;
_triggerAutoRestore = true ;
_triggerAutoRestoreFromFrame = frame ;
RefreshDialog ( ) ;
}
2014-10-15 16:09:14 +00:00
}
2014-07-16 01:37:50 +00:00
}
}
2014-08-23 15:19:48 +00:00
private void TasView_PointedCellChanged ( object sender , InputRoll . CellEventArgs e )
2014-07-09 23:04:22 +00:00
{
2015-02-24 06:47:32 +00:00
// SuuperW: Will this allow TasView to see KeyDown?
TasView . Select ( ) ;
// Temporary test code
TasView . Refresh ( ) ;
2014-08-23 15:19:48 +00:00
// TODO: think about nullability
// For now return if a null because this happens OnEnter which doesn't have any of the below behaviors yet?
// Most of these are stupid but I got annoyed at null crashes
if ( e . OldCell = = null | | e . OldCell . Column = = null | | e . OldCell . RowIndex = = null | |
e . NewCell = = null | | e . NewCell . RowIndex = = null | | e . NewCell . Column = = null )
{
return ;
}
2014-07-11 16:08:47 +00:00
int startVal , endVal ;
2014-08-23 13:14:25 +00:00
if ( e . OldCell . RowIndex . Value < e . NewCell . RowIndex . Value )
2014-07-11 16:08:47 +00:00
{
2014-08-23 13:14:25 +00:00
startVal = e . OldCell . RowIndex . Value ;
endVal = e . NewCell . RowIndex . Value ;
2014-07-11 16:08:47 +00:00
}
else
{
2014-08-23 13:14:25 +00:00
startVal = e . NewCell . RowIndex . Value ;
endVal = e . OldCell . RowIndex . Value ;
2014-07-11 16:08:47 +00:00
}
2014-07-09 23:04:22 +00:00
if ( _startMarkerDrag )
{
2014-08-23 13:14:25 +00:00
if ( e . NewCell . RowIndex . HasValue )
2014-07-09 23:04:22 +00:00
{
2014-08-23 13:14:25 +00:00
GoToFrame ( e . NewCell . RowIndex . Value ) ;
2014-07-09 23:04:22 +00:00
}
}
else if ( _startFrameDrag )
{
2014-08-23 13:14:25 +00:00
if ( e . OldCell . RowIndex . HasValue & & e . NewCell . RowIndex . HasValue )
2014-07-09 23:04:22 +00:00
{
2014-08-29 18:02:23 +00:00
for ( var i = startVal ; i < endVal ; i + + )
2014-07-09 23:04:22 +00:00
{
2014-08-31 15:40:02 +00:00
TasView . SelectRow ( i , true ) ;
2014-07-09 23:04:22 +00:00
}
2014-10-20 00:11:07 +00:00
TasView . Refresh ( ) ;
2014-07-09 23:04:22 +00:00
}
}
2014-08-23 13:14:25 +00:00
else if ( TasView . IsPaintDown & & e . NewCell . RowIndex . HasValue & & ! string . IsNullOrEmpty ( _startBoolDrawColumn ) )
2014-07-11 16:26:19 +00:00
{
2014-08-23 13:14:25 +00:00
if ( e . OldCell . RowIndex . HasValue & & e . NewCell . RowIndex . HasValue )
2014-07-11 16:26:19 +00:00
{
2015-02-24 03:06:57 +00:00
for ( var i = startVal ; i < = endVal ; i + + ) // SuuperW: <= so that it will edit the cell you are hovering over. (Inclusive)
2014-07-11 16:26:19 +00:00
{
2014-07-16 23:04:56 +00:00
SetBoolState ( i , _startBoolDrawColumn , _boolPaintState ) ; // Notice it uses new row, old column, you can only paint across a single column
2014-10-17 20:10:21 +00:00
_triggerAutoRestore = true ;
_triggerAutoRestoreFromFrame = TasView . CurrentCell . RowIndex . Value ;
2014-07-11 16:26:19 +00:00
}
TasView . Refresh ( ) ;
}
}
2014-08-23 13:14:25 +00:00
else if ( TasView . IsPaintDown & & e . NewCell . RowIndex . HasValue & & ! string . IsNullOrEmpty ( _startFloatDrawColumn ) )
2014-07-09 23:04:22 +00:00
{
2014-08-23 13:14:25 +00:00
if ( e . OldCell . RowIndex . HasValue & & e . NewCell . RowIndex . HasValue )
2014-07-11 16:08:47 +00:00
{
2015-02-24 03:06:57 +00:00
for ( var i = startVal ; i < = endVal ; i + + ) // SuuperW: <= so that it will edit the cell you are hovering over. (Inclusive)
2014-07-11 16:08:47 +00:00
{
2014-10-20 19:04:59 +00:00
if ( i < CurrentTasMovie . InputLogLength ) // TODO: how do we really want to handle the user setting the float state of the pending frame?
2014-07-16 23:04:56 +00:00
{
2014-10-20 19:04:59 +00:00
CurrentTasMovie . SetFloatState ( i , _startFloatDrawColumn , _floatPaintState ) ; // Notice it uses new row, old column, you can only paint across a single column
2014-10-17 20:10:21 +00:00
_triggerAutoRestore = true ;
_triggerAutoRestoreFromFrame = TasView . CurrentCell . RowIndex . Value ;
2014-07-16 23:04:56 +00:00
}
2014-07-11 16:08:47 +00:00
}
2014-07-11 16:26:19 +00:00
2014-07-11 16:08:47 +00:00
TasView . Refresh ( ) ;
}
2014-07-09 23:04:22 +00:00
}
}
private void TasView_SelectedIndexChanged ( object sender , EventArgs e )
{
SetSplicer ( ) ;
}
2014-07-17 19:57:44 +00:00
private void TasView_KeyDown ( object sender , KeyEventArgs e )
{
if ( e . Control & & ! e . Shift & & ! e . Alt & & e . KeyCode = = Keys . Left ) // Ctrl + Left
{
GoToPreviousMarker ( ) ;
}
else if ( e . Control & & ! e . Shift & & ! e . Alt & & e . KeyCode = = Keys . Right ) // Ctrl + Left
{
GoToNextMarker ( ) ;
}
2014-07-25 01:02:24 +00:00
else if ( e . Control & & ! e . Shift & & ! e . Alt & & e . KeyCode = = Keys . Up ) // Ctrl + Up
{
GoToPreviousFrame ( ) ;
}
else if ( e . Control & & ! e . Shift & & ! e . Alt & & e . KeyCode = = Keys . Down ) // Ctrl + Down
{
GoToNextFrame ( ) ;
2014-10-17 19:31:42 +00:00
}
else if ( e . Control & & ! e . Alt & & e . Shift & & e . KeyCode = = Keys . R ) // Ctrl + Shift + R
2014-09-01 15:35:48 +00:00
{
TasView . HorizontalOrientation ^ = true ;
2014-07-25 01:02:24 +00:00
}
2014-07-17 19:57:44 +00:00
2015-02-24 06:47:32 +00:00
// SuuperW: Float Editing
if ( _floatEditRow ! = - 1 )
{
float value = CurrentTasMovie . GetFloatValue ( _floatEditRow , _floatEditColumn ) ;
Emulation . Common . ControllerDefinition . FloatRange range = Global . MovieSession . MovieControllerAdapter . Type . FloatRanges
[Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(_floatEditColumn)] ;
// 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 )
{
rMax = range . Min ;
rMin = range . Max ;
}
if ( e . KeyCode = = Keys . Right ) // No arrow key presses are being detected. Why?
value = range . Max ;
else if ( e . KeyCode = = Keys . Left )
value = range . Min ;
else if ( e . KeyCode > = Keys . D0 & & e . KeyCode < = Keys . D9 )
{
_floatTypedValue + = e . KeyCode - Keys . D0 ;
value = Convert . ToSingle ( _floatTypedValue ) ;
}
else if ( e . KeyCode > = Keys . NumPad0 & & e . KeyCode < = Keys . NumPad9 )
{
_floatTypedValue + = e . KeyCode - Keys . NumPad0 ;
value = Convert . ToSingle ( _floatTypedValue ) ;
}
else if ( e . KeyCode = = Keys . OemPeriod & & ! _floatTypedValue . Contains ( '.' ) )
{
if ( _floatTypedValue = = "" )
_floatTypedValue = "0" ;
_floatTypedValue + = "." ;
}
else if ( e . KeyCode = = Keys . OemMinus & & _floatTypedValue = = "" )
_floatTypedValue = "-" ;
else if ( e . KeyCode = = Keys . Back )
{
if ( _floatTypedValue = = "" ) // Very first key press is backspace?
_floatTypedValue = value . ToString ( ) ;
_floatTypedValue = _floatTypedValue . Substring ( 0 , _floatTypedValue . Length - 1 ) ;
if ( _floatTypedValue = = "" | | _floatTypedValue = = "-" )
value = 0f ;
else
value = Convert . ToSingle ( _floatTypedValue ) ;
}
else if ( e . KeyCode = = Keys . Escape )
{
_floatEditRow = - 1 ;
}
else
{
// This needs some way to know what the increment is. (Does the emulator allow, say, 25.8?)
float changeBy = 0 ;
if ( e . KeyCode = = Keys . Up )
changeBy = 1 ; // This is where I'd put increment
else if ( e . KeyCode = = Keys . Down )
changeBy = - 1 ;
if ( e . Shift )
changeBy * = 10 ;
value + = changeBy ;
}
if ( _floatEditRow ! = - 1 & & value ! = CurrentTasMovie . GetFloatValue ( _floatEditRow , _floatEditColumn ) )
{
if ( value > rMax )
value = rMax ;
else if ( value < rMin )
value = rMin ;
CurrentTasMovie . SetFloatState ( _floatEditRow , _floatEditColumn , value ) ;
}
}
TasView . Refresh ( ) ;
}
2014-07-09 23:04:22 +00:00
#endregion
}
}