Highlight branch arrows in a different color if they start/end at the current opcode

This commit is contained in:
Kingcom 2013-10-16 15:15:00 +02:00
parent 480c766776
commit ff5e4b0cf3

View File

@ -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);