Permalink
Browse files

Readability improvements

-Change variable names related to offsets for consistency

-Add a few comments
  • Loading branch information...
dl471 committed Oct 22, 2018
1 parent b25adc7 commit 7f3aaaa0f7a41e4bc66f7037a04f58466adf917a
Showing with 10 additions and 10 deletions.
  1. +7 −7 Windows/Debugger/CtrlMemView.cpp
  2. +3 −3 Windows/Debugger/CtrlMemView.h
@@ -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();
@@ -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;

0 comments on commit 7f3aaaa

Please sign in to comment.