diff --git a/BizHawk.Client.EmuHawk/CustomControls/GDIRenderer.cs b/BizHawk.Client.EmuHawk/CustomControls/GDIRenderer.cs index 4add04fd83..b4a6b68a59 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/GDIRenderer.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/GDIRenderer.cs @@ -62,22 +62,15 @@ namespace BizHawk.Client.EmuHawk.CustomControls #region Api - // TODO: extension method - private static byte[] ImageToByte(Image img) - { - ImageConverter converter = new ImageConverter(); - return (byte[])converter.ConvertTo(img, typeof(byte[])); - } - /// /// Draw a bitmap object at the given position /// - public void DrawBitmap(Bitmap bitmap, int x, int y) + public void DrawBitmap(Bitmap bitmap, Point point) { IntPtr hbmp = bitmap.GetHbitmap(); var bitHDC = CreateCompatibleDC(CurrentHDC); IntPtr old = new IntPtr(SelectObject(bitHDC, hbmp)); - BitBlt(CurrentHDC, x, y, bitmap.Width, bitmap.Height, bitHDC, 0, 0, 0xCC0020); + BitBlt(CurrentHDC, point.X, point.Y, bitmap.Width, bitmap.Height, bitHDC, 0, 0, 0xCC0020); SelectObject(bitHDC, old); DeleteDC(bitHDC); } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs index 077c4e93f5..9674a5d912 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs @@ -205,17 +205,23 @@ namespace BizHawk.Client.EmuHawk #region Event Handlers /// - /// Fire the QueryItemText event which requests the text for the passed Listview cell. + /// Fire the QueryItemText event which requests the text for the passed cell /// [Category("Virtual")] public event QueryItemTextHandler QueryItemText; /// - /// Fire the QueryItemBkColor event which requests the background color for the passed Listview cell + /// Fire the QueryItemBkColor event which requests the background color for the passed cell /// [Category("Virtual")] public event QueryItemBkColorHandler QueryItemBkColor; + /// + /// Fire the QueryItemIconHandler event which requests an icon for a given cell + /// + [Category("Virtual")] + public event QueryItemIconHandler QueryItemIcon; + /// /// Fires when the mouse moves from one cell to another (including column header cells) /// @@ -250,6 +256,11 @@ namespace BizHawk.Client.EmuHawk /// public delegate void QueryItemBkColorHandler(int index, int column, ref Color color); + /// + /// Retrive the image for a given cell + /// + public delegate void QueryItemIconHandler(int index, int column, ref Bitmap icon); + public delegate void CellChangeEventHandler(object sender, CellEventArgs e); public delegate void RightMouseScrollEventHandler(object sender, MouseEventArgs e); @@ -602,10 +613,24 @@ namespace BizHawk.Client.EmuHawk } string text; var point = new Point(col.Left.Value + xPadding, RowsToPixels(i)); - QueryItemText(i + startRow, j, out text); - if (!string.IsNullOrWhiteSpace(text)) + + Bitmap image = null; + if (QueryItemIcon != null) { - Gdi.DrawString(text, point); + QueryItemIcon(i + startRow, j, ref image); + } + + if (image != null) + { + Gdi.DrawBitmap(image, point); + } + else + { + QueryItemText(i + startRow, j, out text); + if (!string.IsNullOrWhiteSpace(text)) + { + Gdi.DrawString(text, point); + } } } } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index 026f25ca58..181398763c 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -41,6 +41,26 @@ namespace BizHawk.Client.EmuHawk #region Query callbacks + private void TasView_QueryItemIcon(int index, int column, ref Bitmap bitmap) + { + var columnName = TasView.Columns[column].Name; + + if (columnName == MarkerColumnName) + { + if (Global.Emulator.Frame == index) + { + if (TasView.HorizontalOrientation) + { + bitmap = Properties.Resources.te_arrow; // TODO: horizontal version + } + else + { + bitmap = Properties.Resources.te_arrow; + } + } + } + } + private void TasView_QueryItemBkColor(int index, int column, ref Color color) { var columnName = TasView.Columns[column].Name; @@ -136,11 +156,11 @@ namespace BizHawk.Client.EmuHawk { if(TasView.HorizontalOrientation) { - text = " V"; + //text = " V"; } else { - text = ">"; + //text = ">"; } } else diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 913ad58b16..f39cbc246a 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -55,6 +55,7 @@ namespace BizHawk.Client.EmuHawk MarkerControl.Tastudio = this; TasView.QueryItemText += TasView_QueryItemText; TasView.QueryItemBkColor += TasView_QueryItemBkColor; + TasView.QueryItemIcon += TasView_QueryItemIcon; TopMost = Global.Config.TAStudioSettings.TopMost; TasView.InputPaintingMode = Global.Config.TAStudioDrawInput;