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) { _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 { 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; } } 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(); } } } } 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); } } } }