Merge branch 'inputroll-rotatefix'

This commit is contained in:
adelikat 2019-10-26 15:37:47 -05:00
commit f7b2982dad
2 changed files with 31 additions and 17 deletions

View File

@ -1,6 +1,6 @@
using System;
using System.Drawing;
namespace BizHawk.Client.EmuHawk.CustomControls
{
public class GdiPlusRenderer : IControlRenderer
@ -12,6 +12,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
private readonly SolidBrush _currentStringBrush = new SolidBrush(Color.Black);
private readonly Font _defaultFont = new Font("Arial", 8, FontStyle.Bold);
private Font _currentFont;
private bool _rotateString;
public GdiPlusRenderer()
{
@ -49,8 +50,18 @@ namespace BizHawk.Client.EmuHawk.CustomControls
}
public void DrawString(string str, Point point)
{
_graphics.DrawString(str, _currentFont, _currentStringBrush, point);
{
if (_rotateString)
{
_graphics.TranslateTransform(point.X, point.Y);
_graphics.RotateTransform(90);
_graphics.DrawString(str, _currentFont, _currentStringBrush, Point.Empty);
_graphics.ResetTransform();
}
else
{
_graphics.DrawString(str, _currentFont, _currentStringBrush, point);
}
}
public void FillRectangle(int x, int y, int w, int h)
@ -79,13 +90,9 @@ namespace BizHawk.Client.EmuHawk.CustomControls
public void PrepDrawString(Font font, Color color, bool rotate = false)
{
if (rotate)
{
// TODO
}
_currentFont = font;
_currentStringBrush.Color = color;
_rotateString = rotate;
}
public void SetBrush(Color color)

View File

@ -199,17 +199,24 @@ namespace BizHawk.Client.EmuHawk
var point = new Point(x + strOffsetX, y + strOffsetY);
var rePrep = false;
if (j == 1)
if (_selectedItems.Contains(new Cell { Column = visibleColumns[j], RowIndex = i + startRow }))
//if (j == 1)
//if (_selectedItems.Contains(new Cell { Column = visibleColumns[j], RowIndex = i + startRow }))
//{
// _renderer.PrepDrawString(_font, SystemColors.HighlightText, rotate: true);
// rePrep = true;
//}
//else if (j == 1)
//{
// // 1. not sure about this; 2. repreps may be excess, but if we render one column at a time, we do need to change back after rendering the header
// rePrep = true;
// _renderer.PrepDrawString(_font, _foreColor, rotate: true);
//}
//if (visibleColumns[j].Type == RollColumn.InputType.Text)
if (visibleColumns[j].Name == "FrameColumn")
{
_renderer.PrepDrawString(_font, SystemColors.HighlightText, rotate: true);
rePrep = true;
}
else if (j == 1)
{
// 1. not sure about this; 2. repreps may be excess, but if we render one column at a time, we do need to change back after rendering the header
rePrep = true;
_renderer.PrepDrawString(_font, _foreColor, rotate: true);
rePrep = true;
}
DrawString(text, ColumnWidth, point);