private void MarkerView_QueryItemBkColor(int index, InputRoll.RollColumn column, ref Color color) { var prev = Markers.PreviousOrCurrent(Global.Emulator.Frame);//Temp fix if (prev != null && index == Markers.IndexOf(prev)) { color = TAStudio.Marker_FrameCol; } else if (index < Markers.Count) { var marker = Markers[index]; var record = Tastudio.CurrentTasMovie[marker.Frame]; if (record.Lagged.HasValue) { if (record.Lagged.Value) { color = column.Name == "FrameColumn" ? TAStudio.LagZone_FrameCol : TAStudio.LagZone_InputLog; } else { color = column.Name == "LabelColumn" ? TAStudio.GreenZone_FrameCol : TAStudio.GreenZone_InputLog; } } else { color = Color.White; } } else color = Color.White; }
public static ToolStripMenuItem ToColumnsMenu(this InputRoll inputRoll, Action changeCallback) { var menu = new ToolStripMenuItem { Name = "GeneratedColumnsSubMenu", Text = "Columns" }; var columns = inputRoll.AllColumns; foreach (var column in columns) { var menuItem = new ToolStripMenuItem { Name = column.Name, Text = $"{column.Text} ({column.Name})", Checked = column.Visible, CheckOnClick = true, Tag = column.Name }; menuItem.CheckedChanged += (o, ev) => { var sender = (ToolStripMenuItem)o; columns.Find(c => c.Name == (string)sender.Tag).Visible = sender.Checked; columns.ColumnsChanged(); changeCallback(); inputRoll.Refresh(); }; menu.DropDownItems.Add(menuItem); } return(menu); }
private Bitmap GetIconOverride(int index, InputRoll.RollColumn column) { if (QueryItemIconCallback != null) { return QueryItemIconCallback(index, column.Name); } return null; }
private Color? GetColorOverride(int index, InputRoll.RollColumn column) { if (QueryItemBgColorCallback != null) { return QueryItemBgColorCallback(index, column.Name); } return null; }
private string GetTextOverride(int index, InputRoll.RollColumn column) { if (QueryItemTextCallback != null) { return QueryItemTextCallback(index, column.Name); } return null; }
private void MarkerView_QueryItemText(int index, InputRoll.RollColumn column, out string text, ref int offsetX, ref int offsetY) { text = ""; if (column.Name == "FrameColumn") { text = Markers[index].Frame.ToString(); } else if (column.Name == "LabelColumn") { text = Markers[index].Message; } }
private void QueryItemText(int index, InputRoll.RollColumn column, out string text, ref int offsetX, ref int offsetY) { text = string.Empty; if (index >= Movie.BranchCount) { return; } switch (column.Name) { case BranchNumberColumnName: text = index.ToString(); break; case FrameColumnName: text = GetBranch(index).Frame.ToString(); break; case TimeColumnName: text = GetBranch(index).TimeStamp.ToString(@"hh\:mm\:ss\.ff"); break; } }
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_ColumnRightClick(object sender, InputRoll.ColumnClickEventArgs e) { e.Column.Emphasis ^= true; UpdateAutoFire(e.Column.Name, e.Column.Emphasis); RefreshTasView(); }
private void TasView_QueryItemText(int index, InputRoll.RollColumn column, out string text) { var overrideText = GetTextOverride(index, column); if (overrideText != null) { text = overrideText; return; } try { text = string.Empty; var columnName = column.Name; if (columnName == CursorColumnName) { // TODO: what logic should we have when there is more than 1? var branch = CurrentTasMovie.TasBranches.FirstOrDefault(x => x.Frame == index); if (branch != null) { text = CurrentTasMovie.TasBranches.IndexOf(branch).ToString(); } } else if (columnName == FrameColumnName) { text = (index).ToString().PadLeft(CurrentTasMovie.InputLogLength.ToString().Length, '0'); } else { if (index < CurrentTasMovie.InputLogLength) text = CurrentTasMovie.DisplayValue(index, columnName); } } catch (Exception ex) { text = string.Empty; MessageBox.Show("oops\n" + ex); } }
private void BranchView_CellHovered(object sender, InputRoll.CellEventArgs e) { if (e.NewCell != null && e.NewCell.RowIndex.HasValue && e.NewCell.Column != null && e.NewCell.RowIndex < Movie.BranchCount) { if (e.NewCell.Column.Name == BranchNumberColumnName) { ScreenShotPopUp(GetBranch(e.NewCell.RowIndex.Value), e.NewCell.RowIndex.Value); } else { CloseScreenShotPopUp(); } } else { CloseScreenShotPopUp(); } }
private void QueryItemText(int index, InputRoll.RollColumn column, out string text) { text = string.Empty; if (index >= Tastudio.CurrentTasMovie.TasBranches.Count) { return; } switch (column.Name) { case BranchNumberColumnName: text = index.ToString(); break; case FrameColumnName: text = Branches[index].Frame.ToString(); break; case TimeColumnName: text = MovieTime(Branches[index].Frame).ToString(@"hh\:mm\:ss\.fff"); break; } }
private void TasView_QueryItemText(int index, InputRoll.RollColumn column, out string text) { var overrideText = GetTextOverride(index, column); if (overrideText != null) { text = overrideText; return; } try { text = string.Empty; var columnName = column.Name; if (columnName == MarkerColumnName) { // Do nothing } else if (columnName == FrameColumnName) { text = (index).ToString().PadLeft(CurrentTasMovie.InputLogLength.ToString().Length, '0'); } else { if (index < CurrentTasMovie.InputLogLength) text = CurrentTasMovie.DisplayValue(index, columnName); } } catch (Exception ex) { text = string.Empty; MessageBox.Show("oops\n" + ex); } }
private void TasView_QueryItemBkColor(int index, InputRoll.RollColumn column, ref Color color) { Color? overrideColor = GetColorOverride(index, column); if (overrideColor.HasValue) { color = overrideColor.Value; return; } string columnName = column.Name; if (columnName == CursorColumnName) color = Color.FromArgb(0xFEFFFF); if (columnName == FrameColumnName) { if (Emulator.Frame != index && CurrentTasMovie.Markers.IsMarker(index) && TasView.denoteMarkersWithBGColor) color = Marker_FrameCol; else color = Color.FromArgb(0x60FFFFFF); } else if (index == _floatEditRow && columnName == _floatEditColumn) { // SuuperW: Analog editing is indicated by a color change. color = AnalogEdit_Col; } int player = Global.Emulator.ControllerDefinition.PlayerNumber(columnName); if (player != 0 && player % 2 == 0) color = Color.FromArgb(0x0D000000); }
private void TasView_QueryItemIcon(int index, InputRoll.RollColumn column, ref Bitmap bitmap, ref int offsetX, ref int offsetY) { var overrideIcon = GetIconOverride(index, column); if (overrideIcon != null) { bitmap = overrideIcon; return; } var columnName = column.Name; if (columnName == CursorColumnName) { if (index == Emulator.Frame && index == GlobalWin.MainForm.PauseOnFrame) { bitmap = TasView.HorizontalOrientation ? ts_v_arrow_green_blue : ts_h_arrow_green_blue; } else if (index == Emulator.Frame) { bitmap = TasView.HorizontalOrientation ? ts_v_arrow_blue : ts_h_arrow_blue; } else if (index == GlobalWin.MainForm.PauseOnFrame) { bitmap = TasView.HorizontalOrientation ? ts_v_arrow_green : ts_h_arrow_green; } } else if (columnName == FrameColumnName) { TasMovieRecord record = CurrentTasMovie[index]; offsetX = -3; offsetY = 1; if (CurrentTasMovie.Markers.IsMarker(index) && TasView.denoteMarkersWithIcons) bitmap = icon_marker; else if (record.HasState && TasView.denoteStatesWithIcons) { if (record.Lagged.HasValue && record.Lagged.Value) bitmap = icon_anchor_lag; else bitmap = icon_anchor; } } }
private void QueryItemBkColor(int index, InputRoll.RollColumn column, ref Color color) { TasBranch branch = GetBranch(index); if (branch != null) { var record = Tastudio.CurrentTasMovie[branch.Frame]; if (index == Movie.CurrentBranch) color = TAStudio.CurrentFrame_InputLog; // SystemColors.HotTrack; else if (record.Lagged.HasValue) { if (record.Lagged.Value) { color = TAStudio.LagZone_InputLog; } else { color = TAStudio.GreenZone_InputLog; } } } // Highlight the branch cell a little, if hovering over it if (BranchView.CurrentCellIsDataCell && BranchView.CurrentCell.Column.Name == BranchNumberColumnName && column.Name == BranchNumberColumnName && index == BranchView.CurrentCell.RowIndex) { color = Color.FromArgb((byte)(color.A - 24), (byte)(color.R - 24), (byte)(color.G - 24), (byte)(color.B - 24)); } }
private void TasView_QueryItemIcon(int index, InputRoll.RollColumn column, ref Bitmap bitmap, ref int offsetX, ref int offsetY) { var overrideIcon = GetIconOverride(index, column); if (overrideIcon != null) { bitmap = overrideIcon; return; } var columnName = column.Name; if (columnName == CursorColumnName) { if (index == Emulator.Frame && index == GlobalWin.MainForm.PauseOnFrame) { bitmap = TasView.HorizontalOrientation ? Properties.Resources.ts_v_arrow_green_blue : Properties.Resources.ts_h_arrow_green_blue; } else if (index == Emulator.Frame) { bitmap = TasView.HorizontalOrientation ? Properties.Resources.ts_v_arrow_blue : Properties.Resources.ts_h_arrow_blue; } else if (index == GlobalWin.MainForm.PauseOnFrame) { bitmap = TasView.HorizontalOrientation ? Properties.Resources.ts_v_arrow_green : Properties.Resources.ts_h_arrow_green; } } else if (columnName == FrameColumnName && VersionInfo.DeveloperBuild) { TasMovieRecord record = CurrentTasMovie[index]; if (record.HasState) { offsetX = -2; offsetY = 2; bitmap = Properties.Resources.anchor; } } }
private void MarkerView_QueryItemText(int index, InputRoll.RollColumn column, out string text) { text = ""; if (column.Name == "FrameColumn") { text = Tastudio.CurrentTasMovie.Markers[index].Frame.ToString(); } else if (column.Name == "LabelColumn") { text = Tastudio.CurrentTasMovie.Markers[index].Message; } }
private void TasView_QueryItemIcon(int index, InputRoll.RollColumn column, ref Bitmap bitmap) { var overrideIcon = GetIconOverride(index, column); if (overrideIcon != null) { bitmap = overrideIcon; return; } var columnName = column.Name; if (columnName == CursorColumnName) { if (index == Emulator.Frame && index == GlobalWin.MainForm.PauseOnFrame) { bitmap = TasView.HorizontalOrientation ? Properties.Resources.ts_v_arrow_green_blue : Properties.Resources.ts_h_arrow_green_blue; } else if (index == Emulator.Frame) { bitmap = TasView.HorizontalOrientation ? Properties.Resources.ts_v_arrow_blue : Properties.Resources.ts_h_arrow_blue; } else if (index == GlobalWin.MainForm.PauseOnFrame) { bitmap = TasView.HorizontalOrientation ? Properties.Resources.ts_v_arrow_green : Properties.Resources.ts_h_arrow_green; } } }
private void TasView_QueryItemBkColor(int index, InputRoll.RollColumn column, ref Color color) { var overrideColor = GetColorOverride(index, column); if (overrideColor.HasValue) { color = overrideColor.Value; return; } string columnName = column.Name; if (columnName == MarkerColumnName) { // For debugging purposes, let's visually show the state frames if (VersionInfo.DeveloperBuild && CurrentTasMovie.TasStateManager.HasState(index)) color = Color.FromArgb(0xEEEEEE); else color = Color.FromArgb(0xFEFFFF); return; } if (columnName == FrameColumnName) { if (Emulator.Frame != index && CurrentTasMovie.Markers.IsMarker(index)) color = Marker_FrameCol; } else if (index == _floatEditRow && columnName == _floatEditColumn) { // SuuperW: Analog editing is indicated by a color change. color = AnalogEdit_Col; } }
private void TasView_QueryItemIcon(int index, InputRoll.RollColumn column, ref Bitmap bitmap) { var columnName = column.Name; if (columnName == MarkerColumnName) { if (index == Emulator.Frame && index == GlobalWin.MainForm.PauseOnFrame) { bitmap = TasView.HorizontalOrientation ? Properties.Resources.ts_v_arrow_green_blue : Properties.Resources.ts_h_arrow_green_blue; } else if (index == Emulator.Frame) { bitmap = TasView.HorizontalOrientation ? Properties.Resources.ts_v_arrow_blue : Properties.Resources.ts_h_arrow_blue; } else if (index == GlobalWin.MainForm.PauseOnFrame) { bitmap = TasView.HorizontalOrientation ? Properties.Resources.ts_v_arrow_green : Properties.Resources.ts_h_arrow_green; } } }
private void TasView_QueryItemText(int index, InputRoll.RollColumn column, out string text, ref int offsetX, ref int offsetY) { var overrideText = GetTextOverride(index, column); if (overrideText != null) { text = overrideText; return; } try { text = string.Empty; var columnName = column.Name; if (columnName == CursorColumnName) { int branchIndex = CurrentTasMovie.BranchIndexByFrame(index); if (branchIndex != -1) { text = branchIndex.ToString(); } } else if (columnName == FrameColumnName) { offsetX = 7; text = (index).ToString().PadLeft(CurrentTasMovie.InputLogLength.ToString().Length, '0'); } else { if (index < CurrentTasMovie.InputLogLength) text = CurrentTasMovie.DisplayValue(index, columnName); } } catch (Exception ex) { text = string.Empty; MessageBox.Show("oops\n" + ex); } }
private void BranchView_CellDropped(object sender, InputRoll.CellEventArgs e) { if (e.NewCell != null && e.NewCell.IsDataCell) { var branch = Branches[e.OldCell.RowIndex.Value]; int originalIndex = Branches.IndexOf(branch); int newIndex = e.NewCell.RowIndex.Value; if (newIndex >= Branches.Count) newIndex = Branches.Count - 1; Branches.Remove(branch); Branches.Insert(newIndex, branch); } }
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) { 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); } } } 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(); } } } 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(); } } } Global.MovieSession.Movie.IsCountingRerecords = wasCountingRerecords; if (mouseButtonHeld) { TasView.MakeIndexVisible(TasView.CurrentCell.RowIndex.Value); // todo: limit scrolling speed } RefreshTasView(); }
private void TasView_CellDropped(object sender, InputRoll.CellEventArgs e) { if (e.NewCell != null && e.NewCell.RowIndex.HasValue && !CurrentTasMovie.Markers.IsMarker(e.NewCell.RowIndex.Value)) { var currentMarker = CurrentTasMovie.Markers.Single(m => m.Frame == e.OldCell.RowIndex.Value); int newFrame = e.NewCell.RowIndex.Value; var newMarker = new TasMovieMarker(newFrame, currentMarker.Message); CurrentTasMovie.Markers.Remove(currentMarker); CurrentTasMovie.Markers.Add(newMarker); RefreshDialog(); } }
private void TasView_ColumnClick(object sender, InputRoll.ColumnClickEventArgs e) { if (TasView.SelectedRows.Any()) { var columnName = e.Column.Name; if (columnName == FrameColumnName) { CurrentTasMovie.Markers.Add(TasView.LastSelectedIndex.Value, ""); RefreshDialog(); } else if (columnName != MarkerColumnName) // TODO: what about float? { foreach (var index in TasView.SelectedRows) { CurrentTasMovie.ToggleBoolState(index, columnName); _triggerAutoRestore = true; _triggerAutoRestoreFromFrame = TasView.SelectedRows.Min(); } RefreshDialog(); } } }
private void BranchView_CellDropped(object sender, InputRoll.CellEventArgs e) { if (e.NewCell != null && e.NewCell.IsDataCell && e.OldCell.RowIndex.Value < Movie.BranchCount) { Movie.SwapBranches(e.OldCell.RowIndex.Value, e.NewCell.RowIndex.Value); } }
private void TasView_ColumnReordered(object sender, InputRoll.ColumnReorderedEventArgs e) { CurrentTasMovie.FlagChanges(); }
private void QueryItemBkColor(int index, InputRoll.RollColumn column, ref Color color) { if (index == CurrentBranch) color = TAStudio.CurrentFrame_InputLog; // SystemColors.HotTrack; // Highlight the branch cell a little, if hovering over it if (BranchView.CurrentCellIsDataCell && BranchView.CurrentCell.Column.Name == BranchNumberColumnName && column.Name == BranchNumberColumnName && index == BranchView.CurrentCell.RowIndex) { color = Color.FromArgb((byte)(color.A - 24), (byte)(color.R - 24), (byte)(color.G - 24), (byte)(color.B - 24)); } }
private void TasView_QueryItemBkColor(int index, InputRoll.RollColumn column, ref Color color) { Color? overrideColor = GetColorOverride(index, column); if (overrideColor.HasValue) { color = overrideColor.Value; return; } string columnName = column.Name; if (columnName == CursorColumnName) { // For debugging purposes, let's visually show the state frames if (VersionInfo.DeveloperBuild && CurrentTasMovie.TasStateManager.HasState(index)) color = Color.FromArgb(0xEEEEEE); else color = Color.FromArgb(0xFEFFFF); return; } if (columnName == FrameColumnName) { if (Emulator.Frame != index && CurrentTasMovie.Markers.IsMarker(index)) color = Marker_FrameCol; else color = Color.FromArgb(32, 0, 0, 0); // same as players 2 and 4 } else if (index == _floatEditRow && columnName == _floatEditColumn) { // SuuperW: Analog editing is indicated by a color change. color = AnalogEdit_Col; } int player = Global.Emulator.ControllerDefinition.PlayerNumber(columnName); if (player != 0 && player % 2 == 0) color = Color.FromArgb(32, 0, 0, 0); }