From 94aff7e47e5291f8eef3a25885f43ccfb19db1c3 Mon Sep 17 00:00:00 2001 From: EmptyChaos Date: Tue, 4 Oct 2016 08:17:46 +0000 Subject: [PATCH 1/2] WxDebugger: Fix variable width fonts in Code/Memory views --- Source/Core/DolphinWX/Debugger/CodeView.cpp | 5 +++-- Source/Core/DolphinWX/Debugger/MemoryView.cpp | 15 ++++----------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Source/Core/DolphinWX/Debugger/CodeView.cpp b/Source/Core/DolphinWX/Debugger/CodeView.cpp index 8bc07036b3..4b5c8e1a87 100644 --- a/Source/Core/DolphinWX/Debugger/CodeView.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeView.cpp @@ -390,8 +390,9 @@ void CCodeView::OnPaint(wxPaintEvent& event) { wxFontMetrics metrics = paint_dc.GetFontMetrics(); char_width = metrics.averageWidth; - if (metrics.height > m_rowHeight) - m_rowHeight = metrics.height; + m_rowHeight = std::max(metrics.height, m_rowHeight); + if (!DebuggerFont.IsFixedWidth()) + char_width = paint_dc.GetTextExtent("mxx").GetWidth() / 3; // (1em + 2ex) / 3 } std::unique_ptr ctx(wxGraphicsContext::Create(paint_dc)); diff --git a/Source/Core/DolphinWX/Debugger/MemoryView.cpp b/Source/Core/DolphinWX/Debugger/MemoryView.cpp index 47c2969dc2..67a38aa0b5 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryView.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryView.cpp @@ -269,22 +269,15 @@ void CMemoryView::OnPaint(wxPaintEvent& event) wxPaintDC dc(this); wxRect rc = GetClientRect(); - if (DebuggerFont.IsFixedWidth()) - { - dc.SetFont(DebuggerFont); - } - else - { - dc.SetFont(wxFont(DebuggerFont.GetPointSize(), wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, - wxFONTWEIGHT_NORMAL, false, "Courier")); - } + dc.SetFont(DebuggerFont); int font_width; { wxFontMetrics metrics = dc.GetFontMetrics(); font_width = metrics.averageWidth; - if (metrics.height > rowHeight) - rowHeight = metrics.height; + rowHeight = std::max(rowHeight, metrics.height); + if (!DebuggerFont.IsFixedWidth()) + font_width = dc.GetTextExtent("mxx").GetWidth() / 3; // (1em + 2ex) / 3 } const int row_start_x = m_left_col_width + 1; From 116348a8777ee7961bbf2f674adcc6420ddc9cb0 Mon Sep 17 00:00:00 2001 From: EmptyChaos Date: Tue, 4 Oct 2016 08:28:01 +0000 Subject: [PATCH 2/2] WxDebugger: Move branch line indent --- Source/Core/DolphinWX/Debugger/CodeView.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinWX/Debugger/CodeView.cpp b/Source/Core/DolphinWX/Debugger/CodeView.cpp index 4b5c8e1a87..6d605b48a4 100644 --- a/Source/Core/DolphinWX/Debugger/CodeView.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeView.cpp @@ -546,7 +546,7 @@ void CCodeView::OnPaint(wxPaintEvent& event) // UnDecorateSymbolName(desc,temp,255,UNDNAME_COMPLETE); if (!desc.empty()) { - ctx->DrawText(StrToWxStr(desc), text_col + 45 * char_width, row_y); + ctx->DrawText(StrToWxStr(desc), text_col + 44 * char_width, row_y); } } @@ -570,7 +570,7 @@ void CCodeView::OnPaint(wxPaintEvent& event) for (int i = 0; i < num_branches; ++i) { - int x = text_col + 52 * char_width + (branches[i].srcAddr % 9) * 8; + int x = text_col + 60 * char_width + (branches[i].srcAddr % 9) * 8; branch_path.MoveToPoint(x - 2 * scale, branches[i].src); if (branches[i].dst < rc.height + 400 && branches[i].dst > -400)