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 + Right { GoToNextMarker(); } // SuuperW: Float Editing if (_floatEditRow != -1) { float value = CurrentTasMovie.GetFloatState(_floatEditRow, _floatEditColumn); float prev = value; string prevTyped = _floatTypedValue; 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 ControllerDefinition.cs, 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) { value = rMax; } else if (e.KeyCode == Keys.Left) { value = rMin; } else if (e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9) { _floatTypedValue += e.KeyCode - Keys.D0; } else if (e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9) { _floatTypedValue += e.KeyCode - Keys.NumPad0; } else if (e.KeyCode == Keys.OemMinus || e.KeyCode == Keys.Subtract) { if (_floatTypedValue.StartsWith("-")) { _floatTypedValue = _floatTypedValue.Substring(1); } else { _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) { if (_floatEditYPos != -1) // Cancel change from dragging cursor { _floatEditYPos = -1; CurrentTasMovie.SetFloatState(_floatEditRow, _floatEditColumn, _floatPaintState); } _floatEditRow = -1; } else { float changeBy = 0; if (e.KeyCode == Keys.Up) { changeBy = 1; // We're assuming for now that ALL float controls should contain integers. } else if (e.KeyCode == Keys.Down) { changeBy = -1; } if (e.Shift) { changeBy *= 10; } value += changeBy; if (changeBy != 0) { _floatTypedValue = value.ToString(); } } if (_floatEditRow == -1) { CurrentTasMovie.ChangeLog.EndBatch(); } else { if (_floatTypedValue == "") { if (prevTyped != "") { value = 0f; CurrentTasMovie.SetFloatState(_floatEditRow, _floatEditColumn, value); } } else { if (float.TryParse(_floatTypedValue, out value)) // String "-" can't be parsed. { if (value > rMax) { value = rMax; } else if (value < rMin) { value = rMin; } CurrentTasMovie.SetFloatState(_floatEditRow, _floatEditColumn, value); } } if (value != prev) // Auto-restore { _triggerAutoRestore = true; JumpToGreenzone(); DoTriggeredAutoRestoreIfNeeded(); } } } RefreshDialog(); }
private void TasView_PointedCellChanged(object sender, InputRoll.CellEventArgs e) { // 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; } int startVal, endVal; int frame = e.NewCell.RowIndex.Value; if (e.OldCell.RowIndex.Value < e.NewCell.RowIndex.Value) { startVal = e.OldCell.RowIndex.Value; endVal = e.NewCell.RowIndex.Value; } else { startVal = e.NewCell.RowIndex.Value; endVal = e.OldCell.RowIndex.Value; } if (_startMarkerDrag) { if (e.NewCell.RowIndex.HasValue) { GoToFrame(e.NewCell.RowIndex.Value); } } else if (_startFrameDrag) { if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue) { for (var i = startVal; i <= endVal; i++) { TasView.SelectRow(i, _frameDragState); } RefreshTasView(); } } else if (_rightClickFrame != -1) { _triggerAutoRestore = true; _supressContextMenu = true; if (frame > CurrentTasMovie.InputLogLength - _rightClickInput.Length) { frame = CurrentTasMovie.InputLogLength - _rightClickInput.Length; } if (_rightClickShift) { if (_rightClickControl) // Insert { // If going backwards, delete! bool shouldInsert = true; if (startVal < _rightClickFrame) { // Cloning to a previous frame makes no sense. startVal = _rightClickFrame - 1; } if (startVal < _rightClickLastFrame) { shouldInsert = false; } if (shouldInsert) { for (int i = startVal + 1; i <= endVal; i++) { CurrentTasMovie.InsertInput(i, _rightClickInput[(i - _rightClickFrame) % _rightClickInput.Length]); } } else { CurrentTasMovie.RemoveFrames(startVal + 1, endVal + 1); } _rightClickLastFrame = frame; } else // Overwrite { for (int i = startVal; i <= endVal; i++) { CurrentTasMovie.SetFrame(i, _rightClickInput[(_rightClickFrame - i) % _rightClickInput.Length]); } if (startVal < _triggerAutoRestoreFromFrame) { _triggerAutoRestoreFromFrame = startVal; } } } else { if (_rightClickControl) { for (int i = 0; i < _rightClickInput.Length; i++) // Re-set initial range, just to verify it's still there. { CurrentTasMovie.SetFrame(_rightClickFrame + i, _rightClickInput[i]); } if (_rightClickOverInput != null) // Restore overwritten input from previous movement { for (int i = 0; i < _rightClickOverInput.Length; i++) { CurrentTasMovie.SetFrame(_rightClickLastFrame + i, _rightClickOverInput[i]); } } else { _rightClickOverInput = new string[_rightClickInput.Length]; } _rightClickLastFrame = frame; // Set new restore log CurrentTasMovie.GetLogEntries().CopyTo(frame, _rightClickOverInput, 0, _rightClickOverInput.Length); for (int i = 0; i < _rightClickInput.Length; i++) // Place copied input { CurrentTasMovie.SetFrame(frame + i, _rightClickInput[i]); } } else { int shiftBy = _rightClickFrame - frame; string[] shiftInput = new string[Math.Abs(shiftBy)]; int shiftFrom = frame; if (shiftBy < 0) { shiftFrom = _rightClickFrame + _rightClickInput.Length; } CurrentTasMovie.GetLogEntries().CopyTo(shiftFrom, shiftInput, 0, shiftInput.Length); int shiftTo = shiftFrom + (_rightClickInput.Length * Math.Sign(shiftBy)); for (int i = 0; i < shiftInput.Length; i++) { CurrentTasMovie.SetFrame(shiftTo + i, shiftInput[i]); } for (int i = 0; i < _rightClickInput.Length; i++) { CurrentTasMovie.SetFrame(frame + i, _rightClickInput[i]); } _rightClickFrame = frame; } if (frame < _triggerAutoRestoreFromFrame) { _triggerAutoRestoreFromFrame = frame; } } RefreshTasView(); } else if (TasView.IsPaintDown && e.NewCell.RowIndex.HasValue && !string.IsNullOrEmpty(_startBoolDrawColumn)) { if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue) { for (var i = startVal + 1; i <= endVal; i++) // SuuperW: <= so that it will edit the cell you are hovering over. (Inclusive) { bool setVal = _boolPaintState; if (_patternPaint && _boolPaintState) { if (CurrentTasMovie[frame].Lagged.HasValue && CurrentTasMovie[frame].Lagged.Value) { setVal = CurrentTasMovie.BoolIsPressed(i - 1, _startBoolDrawColumn); } else { setVal = BoolPatterns[controllerType.BoolButtons.IndexOf(_startBoolDrawColumn)].GetNextValue(); } } CurrentTasMovie.SetBoolState(i, _startBoolDrawColumn, setVal); // Notice it uses new row, old column, you can only paint across a single column if (TasView.CurrentCell.RowIndex.Value < _triggerAutoRestoreFromFrame) { _triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value; } } RefreshTasView(); } } else if (TasView.IsPaintDown && e.NewCell.RowIndex.HasValue && !string.IsNullOrEmpty(_startFloatDrawColumn)) { if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue) { for (var i = startVal + 1; i <= endVal; i++) // SuuperW: <= so that it will edit the cell you are hovering over. (Inclusive) { float setVal = _floatPaintState; if (_patternPaint) { if (CurrentTasMovie[frame].Lagged.HasValue && CurrentTasMovie[frame].Lagged.Value) { setVal = CurrentTasMovie.GetFloatState(i - 1, _startFloatDrawColumn); } else { setVal = FloatPatterns[controllerType.FloatControls.IndexOf(_startFloatDrawColumn)].GetNextValue(); } } CurrentTasMovie.SetFloatState(i, _startFloatDrawColumn, setVal); // Notice it uses new row, old column, you can only paint across a single column if (TasView.CurrentCell.RowIndex.Value < _triggerAutoRestoreFromFrame) { _triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value; } } RefreshTasView(); } } }
private void TasView_PointedCellChanged(object sender, InputRoll.CellEventArgs e) { // 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; } // skip rerecord counting on drawing entirely, mouse down is enough // avoid introducing another global bool wasCountingRerecords = Global.MovieSession.Movie.IsCountingRerecords; int startVal, endVal; int frame = e.NewCell.RowIndex.Value; if (e.OldCell.RowIndex.Value < e.NewCell.RowIndex.Value) { startVal = e.OldCell.RowIndex.Value; endVal = e.NewCell.RowIndex.Value; } else { startVal = e.NewCell.RowIndex.Value; endVal = e.OldCell.RowIndex.Value; } if (_startCursorDrag && !Mainform.IsSeeking) { if (e.NewCell.RowIndex.HasValue) { GoToFrame(e.NewCell.RowIndex.Value); } } else if (_startSelectionDrag) { if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue) { for (var i = startVal; i <= endVal; i++) { TasView.SelectRow(i, _selectionDragState); } SetSplicer(); } } else if (_rightClickFrame != -1) { if (frame > CurrentTasMovie.InputLogLength - _rightClickInput.Length) { frame = CurrentTasMovie.InputLogLength - _rightClickInput.Length; } if (_rightClickShift) { if (_rightClickControl) // Insert { // If going backwards, delete! bool shouldInsert = true; if (startVal < _rightClickFrame) { // Cloning to a previous frame makes no sense. startVal = _rightClickFrame - 1; } if (startVal < _rightClickLastFrame) { shouldInsert = false; } if (shouldInsert) { for (int i = startVal + 1; i <= endVal; i++) { CurrentTasMovie.InsertInput(i, _rightClickInput[(i - _rightClickFrame).Mod(_rightClickInput.Length)]); } } else { CurrentTasMovie.RemoveFrames(startVal + 1, endVal + 1); } _rightClickLastFrame = frame; } else // Overwrite { for (int i = startVal; i <= endVal; i++) { CurrentTasMovie.SetFrame(i, _rightClickInput[(i - _rightClickFrame).Mod(_rightClickInput.Length)]); } } } else { if (_rightClickControl) { for (int i = 0; i < _rightClickInput.Length; i++) // Re-set initial range, just to verify it's still there. { CurrentTasMovie.SetFrame(_rightClickFrame + i, _rightClickInput[i]); } if (_rightClickOverInput != null) // Restore overwritten input from previous movement { for (int i = 0; i < _rightClickOverInput.Length; i++) { CurrentTasMovie.SetFrame(_rightClickLastFrame + i, _rightClickOverInput[i]); } } else { _rightClickOverInput = new string[_rightClickInput.Length]; } _rightClickLastFrame = frame; // Set new restore log CurrentTasMovie.GetLogEntries().CopyTo(frame, _rightClickOverInput, 0, _rightClickOverInput.Length); for (int i = 0; i < _rightClickInput.Length; i++) // Place copied input { CurrentTasMovie.SetFrame(frame + i, _rightClickInput[i]); } } else if (_rightClickAlt) { int shiftBy = _rightClickFrame - frame; string[] shiftInput = new string[Math.Abs(shiftBy)]; int shiftFrom = frame; if (shiftBy < 0) { shiftFrom = _rightClickFrame + _rightClickInput.Length; } CurrentTasMovie.GetLogEntries().CopyTo(shiftFrom, shiftInput, 0, shiftInput.Length); int shiftTo = shiftFrom + (_rightClickInput.Length * Math.Sign(shiftBy)); for (int i = 0; i < shiftInput.Length; i++) { CurrentTasMovie.SetFrame(shiftTo + i, shiftInput[i]); } for (int i = 0; i < _rightClickInput.Length; i++) { CurrentTasMovie.SetFrame(frame + i, _rightClickInput[i]); } _rightClickFrame = frame; } } if (_rightClickAlt || _rightClickControl || _rightClickShift) { JumpToGreenzone(); _triggerAutoRestore = true; _supressContextMenu = true; } } // Left-click else if (TasView.IsPaintDown && e.NewCell.RowIndex.HasValue && !string.IsNullOrEmpty(_startBoolDrawColumn)) { Global.MovieSession.Movie.IsCountingRerecords = false; if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue) { for (int i = startVal; i <= endVal; i++) // Inclusive on both ends (drawing up or down) { bool setVal = _boolPaintState; if (_patternPaint && _boolPaintState) { if (CurrentTasMovie[frame].Lagged.HasValue && CurrentTasMovie[frame].Lagged.Value) { setVal = CurrentTasMovie.BoolIsPressed(i - 1, _startBoolDrawColumn); } else { setVal = BoolPatterns[controllerType.BoolButtons.IndexOf(_startBoolDrawColumn)].GetNextValue(); } } CurrentTasMovie.SetBoolState(i, _startBoolDrawColumn, setVal); // Notice it uses new row, old column, you can only paint across a single column JumpToGreenzone(); } if (!Settings.AutoRestoreOnMouseUpOnly) { _triggerAutoRestore = true; DoTriggeredAutoRestoreIfNeeded(); } } } else if (TasView.IsPaintDown && e.NewCell.RowIndex.HasValue && !string.IsNullOrEmpty(_startFloatDrawColumn)) { Global.MovieSession.Movie.IsCountingRerecords = false; if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue) { for (int i = startVal; i <= endVal; i++) // Inclusive on both ends (drawing up or down) { float setVal = _floatPaintState; if (_patternPaint) { if (CurrentTasMovie[frame].Lagged.HasValue && CurrentTasMovie[frame].Lagged.Value) { setVal = CurrentTasMovie.GetFloatState(i - 1, _startFloatDrawColumn); } else { setVal = FloatPatterns[controllerType.FloatControls.IndexOf(_startFloatDrawColumn)].GetNextValue(); } } CurrentTasMovie.SetFloatState(i, _startFloatDrawColumn, setVal); // Notice it uses new row, old column, you can only paint across a single column JumpToGreenzone(); } if (!Settings.AutoRestoreOnMouseUpOnly) { _triggerAutoRestore = true; DoTriggeredAutoRestoreIfNeeded(); } } } Global.MovieSession.Movie.IsCountingRerecords = wasCountingRerecords; if (mouseButtonHeld) { TasView.MakeIndexVisible(TasView.CurrentCell.RowIndex.Value); // todo: limit scrolling speed } RefreshTasView(); }
private void TasView_MouseDown(object sender, MouseEventArgs e) { // Clicking with left while right is held or vice versa does weird stuff if (mouseButtonHeld) { return; } if (e.Button == MouseButtons.Middle) { TogglePause(); return; } // SuuperW: Moved these. if (TasView.CurrentCell == null || !TasView.CurrentCell.RowIndex.HasValue || TasView.CurrentCell.Column == null) { return; } int frame = TasView.CurrentCell.RowIndex.Value; string buttonName = TasView.CurrentCell.Column.Name; if (e.Button == MouseButtons.Left) { CurrentTasMovie.SupressGreenzonging = true; // This is necessary because we will invalidate, but we won't navigate until mouse up, during that time the user may have emulated frames and we don't want to caputre states for those _leftButtonHeld = true; // SuuperW: Exit float editing mode, or re-enter mouse editing if (_floatEditRow != -1) { if (_floatEditColumn != buttonName || _floatEditRow != frame) { _floatEditRow = -1; RefreshTasView(); } else { _floatEditYPos = e.Y; _floatPaintState = CurrentTasMovie.GetFloatState(frame, buttonName); _triggerAutoRestore = true; _triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value; return; } } if (TasView.CurrentCell.Column.Name == MarkerColumnName) { _startMarkerDrag = true; GoToFrame(TasView.CurrentCell.RowIndex.Value); } else if (TasView.CurrentCell.Column.Name == FrameColumnName) { _startFrameDrag = true; _frameDragState = TasView.SelectedRows.Contains(frame); } else // User changed input { if (Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.Contains(buttonName)) { CurrentTasMovie.ChangeLog.BeginNewBatch("Paint Bool"); CurrentTasMovie.ToggleBoolState(TasView.CurrentCell.RowIndex.Value, buttonName); _triggerAutoRestore = true; _triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value; RefreshDialog(); _startBoolDrawColumn = buttonName; _boolPaintState = CurrentTasMovie.BoolIsPressed(frame, buttonName); if (applyPatternToPaintedInputToolStripMenuItem.Checked && (!onlyOnAutoFireColumnsToolStripMenuItem.Checked || TasView.CurrentCell.Column.Emphasis)) { BoolPatterns[controllerType.BoolButtons.IndexOf(buttonName)].Reset(); BoolPatterns[controllerType.BoolButtons.IndexOf(buttonName)].GetNextValue(); _patternPaint = true; } else { _patternPaint = false; } } else { if (frame >= CurrentTasMovie.InputLogLength) { CurrentTasMovie.SetFloatState(frame, buttonName, 0); RefreshDialog(); } _triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value; _floatPaintState = CurrentTasMovie.GetFloatState(frame, buttonName); if (applyPatternToPaintedInputToolStripMenuItem.Checked && (!onlyOnAutoFireColumnsToolStripMenuItem.Checked || TasView.CurrentCell.Column.Emphasis)) { FloatPatterns[controllerType.FloatControls.IndexOf(buttonName)].Reset(); CurrentTasMovie.SetFloatState(frame, buttonName, FloatPatterns[controllerType.FloatControls.IndexOf(buttonName)].GetNextValue()); _patternPaint = true; } else { _patternPaint = false; } if (e.Clicks != 2) { CurrentTasMovie.ChangeLog.BeginNewBatch("Paint Float"); _startFloatDrawColumn = buttonName; } else // Double-click enters float editing mode { if (_floatEditColumn == buttonName && _floatEditRow == frame) { _floatEditRow = -1; } else { CurrentTasMovie.ChangeLog.BeginNewBatch("Float Edit: " + frame); _floatEditColumn = buttonName; _floatEditRow = frame; _floatTypedValue = ""; _floatEditYPos = e.Y; _triggerAutoRestore = true; _triggerAutoRestoreFromFrame = frame; } RefreshDialog(); } } } } else if (e.Button == System.Windows.Forms.MouseButtons.Right) { if (TasView.CurrentCell.Column.Name == FrameColumnName && frame < CurrentTasMovie.InputLogLength) { _rightClickControl = (Control.ModifierKeys | Keys.Control) == Control.ModifierKeys; _rightClickShift = (Control.ModifierKeys | Keys.Shift) == Control.ModifierKeys; if (TasView.SelectedRows.Contains(frame)) { _rightClickInput = new string[TasView.SelectedRows.Count()]; _rightClickFrame = TasView.FirstSelectedIndex.Value; CurrentTasMovie.GetLogEntries().CopyTo(_rightClickFrame, _rightClickInput, 0, TasView.SelectedRows.Count()); if (_rightClickControl && _rightClickShift) { _rightClickFrame += _rightClickInput.Length; } } else { _rightClickInput = new string[1]; _rightClickInput[0] = CurrentTasMovie.GetLogEntries()[frame]; _rightClickFrame = frame; } _rightClickLastFrame = -1; _triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value; // TODO: Turn off ChangeLog.IsRecording and handle the GeneralUndo here. CurrentTasMovie.ChangeLog.BeginNewBatch("Right-Click Edit"); } } }
private void TasView_MouseDown(object sender, MouseEventArgs e) { // Clicking with left while right is held or vice versa does weird stuff if (mouseButtonHeld) { return; } if (e.Button == MouseButtons.Middle) { if (Mainform.EmulatorPaused) { TasMovieRecord record = CurrentTasMovie[LastPositionFrame]; if (!record.Lagged.HasValue && LastPositionFrame > Global.Emulator.Frame) { StartSeeking(LastPositionFrame); } else { Mainform.UnpauseEmulator(); } } else { Mainform.PauseEmulator(); } return; } // SuuperW: Moved these. if (TasView.CurrentCell == null || !TasView.CurrentCell.RowIndex.HasValue || TasView.CurrentCell.Column == null) { return; } int frame = TasView.CurrentCell.RowIndex.Value; string buttonName = TasView.CurrentCell.Column.Name; if (e.Button == MouseButtons.Left) { bool wasHeld = _leftButtonHeld; _leftButtonHeld = true; // SuuperW: Exit float editing mode, or re-enter mouse editing if (_floatEditRow != -1) { if (_floatEditColumn != buttonName || _floatEditRow != frame) { floatEditRow = -1; RefreshTasView(); } else { _floatEditYPos = e.Y; _floatPaintState = CurrentTasMovie.GetFloatState(frame, buttonName); _triggerAutoRestore = true; JumpToGreenzone(); return; } } if (TasView.CurrentCell.Column.Name == CursorColumnName) { _startCursorDrag = true; GoToFrame(TasView.CurrentCell.RowIndex.Value); } else if (TasView.CurrentCell.Column.Name == FrameColumnName) { if (Control.ModifierKeys == Keys.Alt && CurrentTasMovie.Markers.IsMarker(frame)) { // TODO TasView.DragCurrentCell(); } else { _startSelectionDrag = true; _selectionDragState = TasView.SelectedRows.Contains(frame); } } else // User changed input { bool wasPaused = Mainform.EmulatorPaused; if (Emulator.Frame > frame || CurrentTasMovie.LastValidFrame > frame) { if (wasPaused && !Mainform.IsSeeking && !CurrentTasMovie.LastPositionStable) { LastPositionFrame = Emulator.Frame; CurrentTasMovie.LastPositionStable = true; // until new frame is emulated } } if (Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.Contains(buttonName)) { CurrentTasMovie.ChangeLog.BeginNewBatch("Paint Bool " + buttonName + " from frame " + frame); CurrentTasMovie.ToggleBoolState(TasView.CurrentCell.RowIndex.Value, buttonName); _triggerAutoRestore = true; JumpToGreenzone(); RefreshDialog(); _startBoolDrawColumn = buttonName; _boolPaintState = CurrentTasMovie.BoolIsPressed(frame, buttonName); if (applyPatternToPaintedInputToolStripMenuItem.Checked && (!onlyOnAutoFireColumnsToolStripMenuItem.Checked || TasView.CurrentCell.Column.Emphasis)) { BoolPatterns[controllerType.BoolButtons.IndexOf(buttonName)].Reset(); BoolPatterns[controllerType.BoolButtons.IndexOf(buttonName)].GetNextValue(); _patternPaint = true; } else { _patternPaint = false; } if (!Settings.AutoRestoreOnMouseUpOnly) { DoTriggeredAutoRestoreIfNeeded(); } } else { if (frame >= CurrentTasMovie.InputLogLength) { CurrentTasMovie.SetFloatState(frame, buttonName, 0); RefreshDialog(); } JumpToGreenzone(); _floatPaintState = CurrentTasMovie.GetFloatState(frame, buttonName); if (applyPatternToPaintedInputToolStripMenuItem.Checked && (!onlyOnAutoFireColumnsToolStripMenuItem.Checked || TasView.CurrentCell.Column.Emphasis)) { FloatPatterns[controllerType.FloatControls.IndexOf(buttonName)].Reset(); CurrentTasMovie.SetFloatState(frame, buttonName, FloatPatterns[controllerType.FloatControls.IndexOf(buttonName)].GetNextValue()); _patternPaint = true; } else { _patternPaint = false; } if (e.Clicks != 2) { CurrentTasMovie.ChangeLog.BeginNewBatch("Paint Float " + buttonName + " from frame " + frame); _startFloatDrawColumn = buttonName; } else // Double-click enters float editing mode { if (_floatEditColumn == buttonName && _floatEditRow == frame) { floatEditRow = -1; } else { CurrentTasMovie.ChangeLog.BeginNewBatch("Float Edit: " + frame); _floatEditColumn = buttonName; floatEditRow = frame; _floatTypedValue = ""; _floatEditYPos = e.Y; _triggerAutoRestore = true; JumpToGreenzone(); } RefreshDialog(); } } // taseditor behavior if (!wasPaused) { Mainform.UnpauseEmulator(); } } } else if (e.Button == System.Windows.Forms.MouseButtons.Right) { if (TasView.CurrentCell.Column.Name == FrameColumnName && frame < CurrentTasMovie.InputLogLength) { _rightClickControl = (Control.ModifierKeys | Keys.Control) == Control.ModifierKeys; _rightClickShift = (Control.ModifierKeys | Keys.Shift) == Control.ModifierKeys; _rightClickAlt = (Control.ModifierKeys | Keys.Alt) == Control.ModifierKeys; if (TasView.SelectedRows.Contains(frame)) { _rightClickInput = new string[TasView.SelectedRows.Count()]; _rightClickFrame = TasView.FirstSelectedIndex.Value; CurrentTasMovie.GetLogEntries().CopyTo(_rightClickFrame, _rightClickInput, 0, TasView.SelectedRows.Count()); if (_rightClickControl && _rightClickShift) { _rightClickFrame += _rightClickInput.Length; } } else { _rightClickInput = new string[1]; _rightClickInput[0] = CurrentTasMovie.GetLogEntries()[frame]; _rightClickFrame = frame; } _rightClickLastFrame = -1; if (_rightClickAlt || _rightClickControl || _rightClickShift) { JumpToGreenzone(); // TODO: Turn off ChangeLog.IsRecording and handle the GeneralUndo here. string undoStepName = "Right-Click Edit:"; if (_rightClickShift) { undoStepName += " Extend Input"; if (_rightClickControl) { undoStepName += ", Insert"; } } else { if (_rightClickControl) { undoStepName += " Copy"; } else // _rightClickAlt { undoStepName += " Move"; } } CurrentTasMovie.ChangeLog.BeginNewBatch(undoStepName); } } } }