From 463e875b933705ed9f6e7fa1993eeb931e2154f0 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Sun, 6 Mar 2011 22:57:58 +0000 Subject: [PATCH] Hex Editor - all address displayed now, and a header row added, and font is fixed width --- BizHawk.MultiClient/tools/HexEditor.cs | 29 +++++++++++++++++++---- BizHawk.MultiClient/tools/MemoryViewer.cs | 1 - 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/BizHawk.MultiClient/tools/HexEditor.cs b/BizHawk.MultiClient/tools/HexEditor.cs index 2bd040b0fb..1faa93fb73 100644 --- a/BizHawk.MultiClient/tools/HexEditor.cs +++ b/BizHawk.MultiClient/tools/HexEditor.cs @@ -25,9 +25,11 @@ namespace BizHawk.MultiClient //Show num addresses in group box title (show "address" if 1 address) //big font for currently mouse over'ed value? - Font font = new Font("Courier", 10); + Font font = new Font("Courier New", 10); Brush regBrush = Brushes.Black; + const string HEADER = " 0 1 2 3 4 5 6 7 8 9 A B C D E F"; + int defaultWidth; int defaultHeight; MemoryDomain Domain = new MemoryDomain("NULL", 1, Endian.Little, addr => 0, (a, v) => { }); @@ -69,11 +71,28 @@ namespace BizHawk.MultiClient private void MemoryViewer_Paint(object sender, PaintEventArgs e) { - string row = ""; - for (int x = 0; x < 16; x++) - row += String.Format("{0:X2}", Domain.PeekByte(x)) + " "; //TODO: format based on data size + unchecked + { + e.Graphics.DrawString(HEADER, font, regBrush, new Point(16, 16)); + e.Graphics.DrawLine(new Pen(regBrush), MemoryViewer.Left, 34, MemoryViewer.Right-16, 34); - e.Graphics.DrawString(row, font, regBrush, new Point(16, 16)); + int row = 0; + int rowX = 16; + int rowY = 16; + int rowYoffset = 20; + string rowStr; + + for (int i = 1; i < Domain.Size / 16; i++) + { + rowStr = ""; + for (int j = 0; j < 16; j++) + { + rowStr += String.Format("{0:X2}", Domain.PeekByte(i*j)) + " "; //TODO: format based on data size + } + + e.Graphics.DrawString(rowStr, font, regBrush, new Point(rowX, (rowY*i)+rowYoffset)); + } + } } public void UpdateValues() diff --git a/BizHawk.MultiClient/tools/MemoryViewer.cs b/BizHawk.MultiClient/tools/MemoryViewer.cs index d65a3dbb45..5e3c712935 100644 --- a/BizHawk.MultiClient/tools/MemoryViewer.cs +++ b/BizHawk.MultiClient/tools/MemoryViewer.cs @@ -13,7 +13,6 @@ namespace BizHawk.MultiClient SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); - //SetStyle(ControlStyles.Opaque, true); } } }