[SYSSETUP] Adjust Status Window if Asian (#4280)

The Asian logo and bar positions are different from English or Latin positions, due to Asian font.
Add positional adjustment to IDD_STATUSWINDOW_DLG if Asian.
This commit is contained in:
Katayama Hirofumi MZ 2022-01-14 11:39:24 +09:00 committed by GitHub
parent 4411668e6b
commit ef4f0d07b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -565,6 +565,70 @@ cleanup:
return bRet;
}
static VOID
AdjustStatusMessageWindow(HWND hwndDlg, PDLG_DATA pDlgData)
{
INT xOld, yOld, cxOld, cyOld;
INT xNew, yNew, cxNew, cyNew;
INT cxLabel, cyLabel, dyLabel;
RECT rc, rcBar, rcLabel, rcWnd;
BITMAP bmLogo, bmBar;
DWORD style, exstyle;
HWND hwndLogo = GetDlgItem(hwndDlg, IDC_ROSLOGO);
HWND hwndBar = GetDlgItem(hwndDlg, IDC_BAR);
HWND hwndLabel = GetDlgItem(hwndDlg, IDC_STATUSLABEL);
/* This adjustment is for CJK only */
switch (PRIMARYLANGID(GetUserDefaultLangID()))
{
case LANG_CHINESE:
case LANG_JAPANESE:
case LANG_KOREAN:
break;
default:
return;
}
if (!GetObjectW(pDlgData->hLogoBitmap, sizeof(BITMAP), &bmLogo) ||
!GetObjectW(pDlgData->hBarBitmap, sizeof(BITMAP), &bmBar))
{
return;
}
GetWindowRect(hwndBar, &rcBar);
MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcBar, 2);
dyLabel = bmLogo.bmHeight - rcBar.top;
GetWindowRect(hwndLabel, &rcLabel);
MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcLabel, 2);
cxLabel = rcLabel.right - rcLabel.left;
cyLabel = rcLabel.bottom - rcLabel.top;
MoveWindow(hwndLogo, 0, 0, bmLogo.bmWidth, bmLogo.bmHeight, TRUE);
MoveWindow(hwndBar, 0, bmLogo.bmHeight, bmLogo.bmWidth, bmBar.bmHeight, TRUE);
MoveWindow(hwndLabel, rcLabel.left, rcLabel.top + dyLabel, cxLabel, cyLabel, TRUE);
GetWindowRect(hwndDlg, &rcWnd);
xOld = rcWnd.left;
yOld = rcWnd.top;
cxOld = rcWnd.right - rcWnd.left;
cyOld = rcWnd.bottom - rcWnd.top;
GetClientRect(hwndDlg, &rc);
SetRect(&rc, 0, 0, bmLogo.bmWidth, rc.bottom - rc.top); /* new client size */
style = (DWORD)GetWindowLongPtrW(hwndDlg, GWL_STYLE);
exstyle = (DWORD)GetWindowLongPtrW(hwndDlg, GWL_EXSTYLE);
AdjustWindowRectEx(&rc, style, FALSE, exstyle);
cxNew = rc.right - rc.left;
cyNew = (rc.bottom - rc.top) + dyLabel;
xNew = xOld - (cxNew - cxOld) / 2;
yNew = yOld - (cyNew - cyOld) / 2;
MoveWindow(hwndDlg, xNew, yNew, cxNew, cyNew, TRUE);
}
static INT_PTR CALLBACK
StatusMessageWindowProc(
IN HWND hwndDlg,
@ -622,6 +686,7 @@ StatusMessageWindowProc(
return FALSE;
SetDlgItemTextW(hwndDlg, IDC_STATUSLABEL, szMsg);
AdjustStatusMessageWindow(hwndDlg, pDlgData);
return TRUE;
}