diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs index cd9e98f696..d653384166 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs @@ -25,6 +25,7 @@ namespace BizHawk.Client.EmuHawk private bool _horizontalOrientation = false; private bool _programmaticallyUpdatingScrollBarValues = false; + private int _maxCharactersInHorizontal = 1; private int _rowCount = 0; private Size _charSize; @@ -48,7 +49,7 @@ namespace BizHawk.Client.EmuHawk using (var g = CreateGraphics()) using (var LCK = Gdi.LockGraphics(g)) { - _charSize = Gdi.MeasureString("A", this.Font); + _charSize = Gdi.MeasureString("A", this.Font);//TODO make this a property so changing it updates other values. } UpdateCellSize(); @@ -353,6 +354,22 @@ namespace BizHawk.Client.EmuHawk [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)] public int DrawWidth { get; private set; } + /// + /// Sets the width of data cells when in Horizontal orientation. + /// + /// The maximum number of characters the column will support in Horizontal orientation. + public int MaxCharactersInHorizontal{ + get + { + return _maxCharactersInHorizontal; + } + set + { + _maxCharactersInHorizontal = value; + UpdateCellSize(); + } + } + [Browsable(false)] [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)] public bool RightButtonHeld { get; set; } @@ -819,14 +836,15 @@ namespace BizHawk.Client.EmuHawk w = CellWidth - 1; y = (CellHeight * _columns.IndexOf(cell.Column)) + 1; // We can't draw without row and column, so assume they exist and fail catastrophically if they don't h = CellHeight - 1; + if (x < ColumnWidth) { return; } } else { w = cell.Column.Width.Value - 1; x = cell.Column.Left.Value - HBar.Value + 1; - y = RowsToPixels(cell.RowIndex.Value) + 1; // We can't draw without row and column, so assume they exist and fail catastrophically if they don't h = CellHeight - 1; + if (y < ColumnHeight) { return; } } if (x > DrawWidth || y > DrawHeight) { return; }//Don't draw if off screen. @@ -907,20 +925,15 @@ namespace BizHawk.Client.EmuHawk #region Mouse and Key Events - protected override void OnKeyDown(KeyEventArgs e) - { - if (e.Control && !e.Alt && e.Shift && e.KeyCode == Keys.R) // Ctrl + Shift + R - { - HorizontalOrientation ^= true; - Refresh(); - } - - base.OnKeyDown(e); - } + //protected override void OnKeyDown(KeyEventArgs e) + //{ + // base.OnKeyDown(e); + //} protected override void OnMouseMove(MouseEventArgs e) { var newCell = CalculatePointedCell(e.X, e.Y); + newCell.RowIndex += FirstVisibleRow; if (!newCell.Equals(CurrentCell)) { CellChanged(newCell); @@ -966,40 +979,40 @@ namespace BizHawk.Client.EmuHawk } if (e.Button == MouseButtons.Left) - { - if (IsHoveringOnColumnCell) { - ColumnClickEvent(ColumnAtX(e.X)); - } - else if (IsHoveringOnDataCell) - { - if (ModifierKeys == Keys.Alt) + if (IsHoveringOnColumnCell) { - MessageBox.Show("Alt click logic is not yet implemented"); + ColumnClickEvent(ColumnAtX(e.X)); } - else if (ModifierKeys == Keys.Shift) + else if (IsHoveringOnDataCell) { - if (SelectedItems.Any()) + if (ModifierKeys == Keys.Alt) { - MessageBox.Show("Shift click logic is not yet implemented"); + MessageBox.Show("Alt click logic is not yet implemented"); } - else + else if (ModifierKeys == Keys.Shift) + { + if (SelectedItems.Any()) + { + MessageBox.Show("Shift click logic is not yet implemented"); + } + else + { + SelectCell(CurrentCell); + } + } + else if (ModifierKeys == Keys.Control) { SelectCell(CurrentCell); } - } - else if (ModifierKeys == Keys.Control) - { - SelectCell(CurrentCell); - } - else - { - SelectedItems.Clear(); - SelectCell(CurrentCell); - } + else + { + SelectedItems.Clear(); + SelectCell(CurrentCell); + } - Refresh(); - } + Refresh(); + } } base.OnMouseDown(e); @@ -1095,6 +1108,7 @@ namespace BizHawk.Client.EmuHawk HBar.Value = temp.Value; HBar.Maximum = temp.Maximum; HBar.Minimum = temp.Minimum; + Refresh(); } /// @@ -1315,9 +1329,10 @@ namespace BizHawk.Client.EmuHawk /// /// Finds the specific cell that contains the (x, y) coordinate. /// + /// The row number that it returns will be between 0 and VisibleRows, NOT the absolute row number. /// X coordinate point. /// Y coordinate point. - /// The cell with row number and RollColumn reference, both of which can be null. + /// The cell with row number and RollColumn reference, both of which can be null. private Cell CalculatePointedCell(int x, int y) { var newCell = new Cell(); @@ -1503,12 +1518,12 @@ namespace BizHawk.Client.EmuHawk private int CellHeight { get; set; } /// - /// Call when _charSize or CellPadding is changed. + /// Call when _charSize, MaxCharactersInHorizontal, or CellPadding is changed. /// private void UpdateCellSize() { CellHeight = _charSize.Height + CellPadding * 2; - CellWidth = _charSize.Width + CellPadding * 4; // Double the padding for horizontal because it looks better + CellWidth = _charSize.Width * MaxCharactersInHorizontal + CellPadding * 4; // Double the padding for horizontal because it looks better } #endregion diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index 2e1a9ef253..5994dd28e6 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -392,6 +392,9 @@ namespace BizHawk.Client.EmuHawk else if (e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Down) // Ctrl + Down { GoToNextFrame(); + }else if (e.Control && !e.Alt && e.Shift && e.KeyCode == Keys.R) // Ctrl + Shift + R + { + TasView.HorizontalOrientation ^= true; } } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index d3f9d2c27f..913ad58b16 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -60,6 +60,7 @@ namespace BizHawk.Client.EmuHawk TasView.InputPaintingMode = Global.Config.TAStudioDrawInput; TasView.PointedCellChanged += TasView_PointedCellChanged; TasView.MultiSelect = true; + TasView.MaxCharactersInHorizontal = 5; } private void ConvertCurrentMovieToTasproj()