Skip to content

Commit

Permalink
[MSGINA] Adjust Status Window if Asian
Browse files Browse the repository at this point in the history
The Asian logo and bar positions are different from English or Latin positions, due to Asian font.
Add positional adjustment to IDD_STATUS if Asian.
Follow-up of reactos#4280 ef4f0d0.
  • Loading branch information
katahiromz committed Jan 14, 2022
1 parent ef4f0d0 commit 04a7134
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 3 deletions.
65 changes: 65 additions & 0 deletions dll/win32/msgina/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,69 @@ SetWelcomeText(HWND hWnd)
RegCloseKey(hKey);
}

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

/* 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
StatusDialogProc(
Expand Down Expand Up @@ -226,6 +289,8 @@ StatusDialogProc(
pDlgData->hWndBarCtrl = GetDlgItem(hwndDlg, IDC_BAR);
}
}

AdjustStatusMessageWindow(hwndDlg, pDlgData);
return TRUE;
}

Expand Down
6 changes: 3 additions & 3 deletions dll/win32/msgina/lang/ja-JP.rc
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT

IDD_STATUS DIALOGEX 0, 0, 236, 78
IDD_STATUS DIALOGEX 0, 0, 275, 78
STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP
CAPTION "お待ちください..."
FONT 9, "MS UI Gothic", 400, 0, 1
BEGIN
CONTROL IDI_ROSLOGO, IDC_ROSLOGO, "Static", SS_BITMAP, 0, 0, 275, 54
CONTROL "", IDC_BAR, "Static", SS_OWNERDRAW, 0, 35, 275, 4
LTEXT "", IDC_STATUS_MESSAGE, 7, 59, 229, 12, SS_WORDELLIPSIS
CONTROL "", IDC_BAR, "Static", SS_OWNERDRAW, 0, 44, 275, 4
LTEXT "", IDC_STATUS_MESSAGE, 7, 59, 261, 12, SS_WORDELLIPSIS
END

IDD_WELCOME DIALOGEX 0, 0, 236, 78
Expand Down

0 comments on commit 04a7134

Please sign in to comment.