|
|
| version 1.13, 2006/12/24 13:21:38 | version 1.14, 2007/10/26 14:38:34 |
|---|---|
| Line 10 | Line 10 |
| #include "np2info.h" | #include "np2info.h" |
| static SIZE aboutsize; | static SIZE s_szAbout; |
| static const OEMCHAR str_np2title[] = OEMTEXT(PROJECTNAME) \ | static const OEMCHAR str_np2title[] = OEMTEXT(PROJECTNAME) \ |
| OEMTEXT(PROJECTSUBNAME) \ | OEMTEXT(PROJECTSUBNAME) \ |
| Line 18 static const OEMCHAR str_np2title[] = OE | Line 18 static const OEMCHAR str_np2title[] = OE |
| static const OEMCHAR np2infostr[] = OEMTEXT("CPU: %CPU% %CLOCK%\nMEM: %MEM1%\nGDC: %GDC%\n %GDC2%\nTEXT: %TEXT%\nGRPH: %GRPH%\nSOUND: %EXSND%\n\nBIOS: %BIOS%\nRHYTHM: %RHYTHM%\n\nSCREEN: %DISP%"); | static const OEMCHAR np2infostr[] = OEMTEXT("CPU: %CPU% %CLOCK%\nMEM: %MEM1%\nGDC: %GDC%\n %GDC2%\nTEXT: %TEXT%\nGRPH: %GRPH%\nSOUND: %EXSND%\n\nBIOS: %BIOS%\nRHYTHM: %RHYTHM%\n\nSCREEN: %DISP%"); |
| static void about_init(HWND hWnd) { | static void onInitDialog(HWND hWnd) |
| { | |
| OEMCHAR work[128]; | OEMCHAR szWork[128]; |
| RECT rectwindow; | RECT rect; |
| RECT rectclient; | RECT rectMore; |
| RECT rectInfo; | |
| int nHeight; | |
| POINT pt; | POINT pt; |
| RECT parent; | #if defined(OSLANG_UTF8) |
| TCHAR szWork2[128]; | |
| #endif // defined(OSLANG_UTF8) | |
| milstr_ncpy(work, str_np2title, NELEMENTS(work)); | milstr_ncpy(szWork, str_np2title, NELEMENTS(szWork)); |
| milstr_ncat(work, np2version, NELEMENTS(work)); | milstr_ncat(szWork, np2version, NELEMENTS(szWork)); |
| #if defined(NP2VER_WIN9X) | #if defined(NP2VER_WIN9X) |
| milstr_ncat(work, NP2VER_WIN9X, NELEMENTS(work)); | milstr_ncat(szWork, NP2VER_WIN9X, NELEMENTS(szWork)); |
| #endif | #endif |
| #if defined(OSLANG_UTF8) | #if defined(OSLANG_UTF8) |
| TCHAR tchr[128]; | oemtotchar(szWork2, NELEMENTS(szWork2), szWork, -1); |
| oemtotchar(tchr, NELEMENTS(tchr), work, -1); | SetDlgItemText(hWnd, IDC_NP2VER, szWork2); |
| SetDlgItemText(hWnd, IDC_NP2VER, tchr); | |
| #else | #else |
| SetDlgItemText(hWnd, IDC_NP2VER, work); | SetDlgItemText(hWnd, IDC_NP2VER, szWork); |
| #endif | #endif |
| GetWindowRect(hWnd, &rectwindow); | |
| GetClientRect(hWnd, &rectclient); | GetWindowRect(hWnd, &rect); |
| aboutsize.cx = rectwindow.right - rectwindow.left; | s_szAbout.cx = rect.right - rect.left; |
| aboutsize.cy = rectwindow.bottom - rectwindow.top; | s_szAbout.cy = rect.bottom - rect.top; |
| pt.x = 0; | |
| pt.y = 0; | if ((dlgs_getitemrect(hWnd, IDC_MORE, &rectMore)) && |
| ClientToScreen(GetParent(hWnd), &pt); | (dlgs_getitemrect(hWnd, IDC_NP2INFO, &rectInfo))) |
| GetClientRect(GetParent(hWnd), &parent); | { |
| np2class_move(hWnd, | nHeight = s_szAbout.cy - (rectInfo.bottom - rectMore.bottom); |
| pt.x + ((parent.right - parent.left - aboutsize.cx) / 2), | GetClientRect(GetParent(hWnd), &rect); |
| pt.y + ((parent.bottom - parent.top - aboutsize.cy) / 2), | pt.x = (rect.right - rect.left - s_szAbout.cx) / 2; |
| aboutsize.cx, | pt.y = (rect.bottom - rect.top - s_szAbout.cy) / 2; |
| aboutsize.cy + 60 - (rectclient.bottom - rectclient.top)); | ClientToScreen(GetParent(hWnd), &pt); |
| np2class_move(hWnd, pt.x, pt.y, s_szAbout.cx, nHeight); | |
| } | |
| SetFocus(GetDlgItem(hWnd, IDOK)); | SetFocus(GetDlgItem(hWnd, IDOK)); |
| } | } |
| static void about_more(HWND hWnd) { | static void onMore(HWND hWnd) |
| { | |
| OEMCHAR infostr[1024]; | OEMCHAR szInfo[1024]; |
| RECT rect; | RECT rect; |
| #if defined(OSLANG_UTF8) | |
| TCHAR szInfo2[1024]; | |
| #endif // defined(OSLANG_UTF8) | |
| np2info(infostr, np2infostr, NELEMENTS(infostr), NULL); | np2info(szInfo, np2infostr, NELEMENTS(szInfo), NULL); |
| #if defined(OSLANG_UTF8) | #if defined(OSLANG_UTF8) |
| TCHAR tchr[1024]; | oemtotchar(szInfo2, NELEMENTS(szInfo2), szInfo, -1); |
| oemtotchar(tchr, NELEMENTS(tchr), infostr, -1); | SetDlgItemText(hWnd, IDC_NP2INFO, szInfo2); |
| SetDlgItemText(hWnd, IDC_NP2INFO, tchr); | |
| #else | #else |
| SetDlgItemText(hWnd, IDC_NP2INFO, infostr); | SetDlgItemText(hWnd, IDC_NP2INFO, szInfo); |
| #endif | #endif |
| EnableWindow(GetDlgItem(hWnd, IDC_MORE), FALSE); | EnableWindow(GetDlgItem(hWnd, IDC_MORE), FALSE); |
| GetWindowRect(hWnd, &rect); | GetWindowRect(hWnd, &rect); |
| np2class_move(hWnd, rect.left, rect.top, aboutsize.cx, aboutsize.cy); | np2class_move(hWnd, rect.left, rect.top, s_szAbout.cx, s_szAbout.cy); |
| SetFocus(GetDlgItem(hWnd, IDOK)); | SetFocus(GetDlgItem(hWnd, IDOK)); |
| } | } |
| LRESULT CALLBACK AboutDialogProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { | LRESULT CALLBACK AboutDialogProc(HWND hWnd, UINT uMsg, |
| WPARAM wParam, LPARAM lParam) | |
| switch (msg) { | { |
| switch(uMsg) | |
| { | |
| case WM_INITDIALOG: | case WM_INITDIALOG: |
| about_init(hWnd); | onInitDialog(hWnd); |
| return(FALSE); | break; |
| case WM_COMMAND: | case WM_COMMAND: |
| switch (LOWORD(wp)) { | switch (LOWORD(wParam)) |
| { | |
| case IDOK: | case IDOK: |
| EndDialog(hWnd, IDOK); | EndDialog(hWnd, IDOK); |
| break; | return TRUE; |
| case IDC_MORE: | case IDC_MORE: |
| about_more(hWnd); | onMore(hWnd); |
| break; | break; |
| default: | |
| return(FALSE); | |
| } | } |
| break; | break; |
| case WM_CLOSE: | case WM_CLOSE: |
| PostMessage(hWnd, WM_COMMAND, IDOK, 0); | PostMessage(hWnd, WM_COMMAND, IDOK, 0); |
| break; | break; |
| default: | |
| return(FALSE); | |
| } | } |
| return(TRUE); | return FALSE; |
| } | } |