From ff5e4b0cf3a9e7b884d9b68a405862dd6de73d4e Mon Sep 17 00:00:00 2001 From: Kingcom Date: Wed, 16 Oct 2013 15:15:00 +0200 Subject: [PATCH] Highlight branch arrows in a different color if they start/end at the current opcode --- Windows/Debugger/CtrlDisAsmView.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Windows/Debugger/CtrlDisAsmView.cpp b/Windows/Debugger/CtrlDisAsmView.cpp index 36036360ba..aff7157337 100644 --- a/Windows/Debugger/CtrlDisAsmView.cpp +++ b/Windows/Debugger/CtrlDisAsmView.cpp @@ -484,7 +484,18 @@ void CtrlDisAsmView::assembleOpcode(u32 address, std::string defaultText) void CtrlDisAsmView::drawBranchLine(HDC hdc, BranchLine& line) { + HPEN pen; u32 windowEnd = windowStart+(visibleRows+2)*instructionSize; + + // highlight line in a different color if it affects the currently selected opcode + if (line.first == curAddress || line.second == curAddress) + { + pen = CreatePen(0,0,0x257AFA); + } else { + pen = CreatePen(0,0,0xFF3020); + } + + HPEN oldPen = (HPEN) SelectObject(hdc,pen); int topY; int bottomY; @@ -562,6 +573,8 @@ void CtrlDisAsmView::drawBranchLine(HDC hdc, BranchLine& line) LineTo(hdc,x+1,bottomY+5); } } + + SelectObject(hdc,oldPen); } void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam) @@ -577,7 +590,6 @@ void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam) SetBkMode(hdc, TRANSPARENT); HPEN nullPen=CreatePen(0,0,0xffffff); - HPEN condPen=CreatePen(0,0,0xFF3020); HBRUSH nullBrush=CreateSolidBrush(0xffffff); HBRUSH currentBrush=CreateSolidBrush(0xFFEfE8); @@ -665,7 +677,6 @@ void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam) SelectObject(hdc,font); } - SelectObject(hdc,condPen); for (size_t i = 0; i < visibleFunctionAddresses.size(); i++) { auto it = functions.find(visibleFunctionAddresses[i]); @@ -693,7 +704,6 @@ void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam) DeleteDC(hdc); DeleteObject(nullPen); - DeleteObject(condPen); DeleteObject(nullBrush); DeleteObject(currentBrush);