Readability improvements

-Change variable names related to offsets for consistency

-Add a few comments
This commit is contained in:
dl471 2018-10-22 03:17:45 +01:00
parent b25adc7ba8
commit 7f3aaaa0f7
2 changed files with 10 additions and 10 deletions

View File

@ -198,9 +198,9 @@ void CtrlMemView::onPaint(WPARAM wParam, LPARAM lParam)
SelectObject(hdc,standardBrush);
Rectangle(hdc,0,0,rect.right,rect.bottom);
if (writeOffsets) {
if (displayOffsetScale)
drawOffsetScale(hdc);
}
// draw one extra row that may be partially visible
for (int i = 0; i < visibleRows+1; i++)
@ -210,7 +210,7 @@ void CtrlMemView::onPaint(WPARAM wParam, LPARAM lParam)
unsigned int address=windowStart + i*rowSize;
int rowY = rowHeight*i;
if (writeOffsets)
if (displayOffsetScale)
rowY += rowHeight * offsetSpace; // skip the first X rows to make space for the offsets
@ -419,7 +419,7 @@ void CtrlMemView::redraw()
GetClientRect(wnd, &rect);
visibleRows = (rect.bottom/rowHeight);
if (writeOffsets) {
if (displayOffsetScale) {
visibleRows -= offsetSpace; // visibleRows is calculated based on the size of the control, but X rows have already been used for the offsets and are no longer usable
}
@ -531,7 +531,7 @@ void CtrlMemView::gotoPoint(int x, int y)
int line = y/rowHeight;
int lineAddress = windowStart+line*rowSize;
if (writeOffsets)
if (displayOffsetScale)
{
if (line < offsetSpace) // ignore clicks on the offset space
{
@ -757,9 +757,9 @@ void CtrlMemView::drawOffsetScale(HDC hdc)
void CtrlMemView::toggleOffsetScale(OffsetToggles toggle)
{
if (toggle == On)
writeOffsets = true;
displayOffsetScale = true;
else if (toggle == Off)
writeOffsets = false;
displayOffsetScale = false;
updateStatusBarText();
redraw();

View File

@ -20,8 +20,8 @@
#include "../../Core/Debugger/DebugInterface.h"
enum OffsetSpacing {
offsetSpace = 3,
offsetLine = 1,
offsetSpace = 3, // the number of blank lines that should be left to make space for the offsets
offsetLine = 1, // the line on which the offsets should be written
};
enum OffsetToggles {
@ -49,7 +49,7 @@ class CtrlMemView
bool asciiSelected;
int selectedNibble;
bool writeOffsets = false;
bool displayOffsetScale = false;
int visibleRows;