[MSPAINT] Define GRIP_SIZE macro and use it (#4192)

Reduce magic numbers. CORE-17931
This commit is contained in:
Katayama Hirofumi MZ 2021-12-26 23:05:47 +09:00 committed by GitHub
parent 9e1386db43
commit 614354ccb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 51 additions and 53 deletions

View file

@ -52,8 +52,6 @@ CONST INT VSCROLL_WIDTH = ::GetSystemMetrics(SM_CXVSCROLL);
void
UpdateScrollbox()
{
CONST INT EXTRASIZE = 5; /* 3 px of selection markers + 2 px of border */
CRect tempRect;
CSize sizeImageArea;
CSize sizeScrollBox;
@ -65,7 +63,7 @@ UpdateScrollbox()
imageArea.GetClientRect(&tempRect);
sizeImageArea = CSize(tempRect.Width(), tempRect.Height());
sizeImageArea += CSize(EXTRASIZE * 2, EXTRASIZE * 2);
sizeImageArea += CSize(GRIP_SIZE * 2, GRIP_SIZE * 2);
/* show/hide the scrollbars */
vmode = (sizeScrollBox.cy < sizeImageArea.cy ? 0 :
@ -132,8 +130,9 @@ LRESULT CScrollboxWindow::OnHScroll(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
}
scrollboxWindow.SetScrollInfo(SB_HORZ, &si);
scrlClientWindow.MoveWindow(-scrollboxWindow.GetScrollPos(SB_HORZ),
-scrollboxWindow.GetScrollPos(SB_VERT), Zoomed(imageModel.GetWidth()) + 6,
Zoomed(imageModel.GetHeight()) + 6, TRUE);
-scrollboxWindow.GetScrollPos(SB_VERT),
Zoomed(imageModel.GetWidth()) + 2 * GRIP_SIZE,
Zoomed(imageModel.GetHeight()) + 2 * GRIP_SIZE, TRUE);
}
return 0;
}
@ -167,8 +166,9 @@ LRESULT CScrollboxWindow::OnVScroll(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
}
scrollboxWindow.SetScrollInfo(SB_VERT, &si);
scrlClientWindow.MoveWindow(-scrollboxWindow.GetScrollPos(SB_HORZ),
-scrollboxWindow.GetScrollPos(SB_VERT), Zoomed(imageModel.GetWidth()) + 6,
Zoomed(imageModel.GetHeight()) + 6, TRUE);
-scrollboxWindow.GetScrollPos(SB_VERT),
Zoomed(imageModel.GetWidth()) + 2 * GRIP_SIZE,
Zoomed(imageModel.GetHeight()) + 2 * GRIP_SIZE, TRUE);
}
return 0;
}