--- np2/win9x/dialog/d_screen.cpp 2007/10/26 14:38:34 1.14 +++ np2/win9x/dialog/d_screen.cpp 2011/03/07 09:54:11 1.18 @@ -1,23 +1,31 @@ -#include "compiler.h" -#include -#include -#include "strres.h" -#include "resource.h" -#include "np2.h" -#include "oemtext.h" -#include "scrnmng.h" -#include "sysmng.h" -#include "np2class.h" -#include "dialog.h" -#include "dialogs.h" -#include "pccore.h" -#include "iocore.h" -#include "scrndraw.h" -#include "palettes.h" - - -static const TCHAR str_scropt[] = _T("Screen option"); - +/** + * @file d_screen.cpp + * @brief Screen configure dialog procedure + * + * @author $Author: yui $ + * @date $Date: 2011/03/07 09:54:11 $ + */ + +#include "compiler.h" +#include +#include +#include "strres.h" +#include "resource.h" +#include "np2.h" +#include "oemtext.h" +#include "scrnmng.h" +#include "sysmng.h" +#include "np2class.h" +#include "dialog.h" +#include "dialogs.h" +#include "pccore.h" +#include "iocore.h" +#include "scrndraw.h" +#include "palettes.h" + +#if !defined(__GNUC__) +#pragma comment(lib, "comctl32.lib") +#endif // !defined(__GNUC__) static LRESULT CALLBACK Scropt1DlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { @@ -264,17 +272,18 @@ static LRESULT CALLBACK Scropt3DlgProc(H return(FALSE); } -static const TCHAR *pszZoom[] = { - MAKEINTRESOURCE(IDS_ZOOM_NONE), - MAKEINTRESOURCE(IDS_ZOOM_FIXEDASPECT), - MAKEINTRESOURCE(IDS_ZOOM_ADJUSTASPECT), - MAKEINTRESOURCE(IDS_ZOOM_FULL)}; +static const CBPARAM cpZoom[] = +{ + {MAKEINTRESOURCE(IDS_ZOOM_NONE), 0}, + {MAKEINTRESOURCE(IDS_ZOOM_FIXEDASPECT), 1}, + {MAKEINTRESOURCE(IDS_ZOOM_ADJUSTASPECT), 2}, + {MAKEINTRESOURCE(IDS_ZOOM_FULL), 3}, +}; static LRESULT CALLBACK ScroptFullScreenDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { UINT8 c; - UINT uUpdate; switch(uMsg) { @@ -284,9 +293,9 @@ static LRESULT CALLBACK ScroptFullScreen (c & FSCRNMOD_SAMEBPP)); SetDlgItemCheck(hWnd, IDC_FULLSCREEN_SAMERES, (c & FSCRNMOD_SAMERES)); - dlgs_setdroplistitem(hWnd, IDC_FULLSCREEN_ZOOM, - pszZoom, NELEMENTS(pszZoom)); - dlgs_setdroplistnumber(hWnd, IDC_FULLSCREEN_ZOOM, (c & 3)); + dlgs_setcbitem(hWnd, IDC_FULLSCREEN_ZOOM, + cpZoom, NELEMENTS(cpZoom)); + dlgs_setcbcur(hWnd, IDC_FULLSCREEN_ZOOM, (c & 3)); EnableWindow(GetDlgItem(hWnd, IDC_FULLSCREEN_ZOOM), (c & FSCRNMOD_SAMERES) != 0); return(TRUE); @@ -313,13 +322,12 @@ static LRESULT CALLBACK ScroptFullScreen { c |= FSCRNMOD_SAMERES; } - c |= (dlgs_getdroplistnumber(hWnd, IDC_FULLSCREEN_ZOOM) & 3); + c |= dlgs_getcbcur(hWnd, IDC_FULLSCREEN_ZOOM, 0); if (np2oscfg.fscrnmod != c) { np2oscfg.fscrnmod = c; - uUpdate |= SYS_UPDATEOSCFG; + sysmng_update(SYS_UPDATEOSCFG); } - sysmng_update(uUpdate); return(TRUE); } break; @@ -327,19 +335,20 @@ static LRESULT CALLBACK ScroptFullScreen return(FALSE); } -void dialog_scropt(HWND hWnd) { - - HINSTANCE hinst; +void dialog_scropt(HWND hWnd) +{ + HINSTANCE hInstance; PROPSHEETPAGE psp; PROPSHEETHEADER psh; HPROPSHEETPAGE hpsp[4]; + TCHAR szTitle[128]; - hinst = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE); + hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE); ZeroMemory(&psp, sizeof(psp)); psp.dwSize = sizeof(PROPSHEETPAGE); psp.dwFlags = PSP_DEFAULT; - psp.hInstance = hinst; + psp.hInstance = hInstance; psp.pszTemplate = MAKEINTRESOURCE(IDD_SCROPT1); psp.pfnDlgProc = (DLGPROC)Scropt1DlgProc; @@ -357,17 +366,19 @@ void dialog_scropt(HWND hWnd) { psp.pfnDlgProc = (DLGPROC)ScroptFullScreenDlgProc; hpsp[3] = CreatePropertySheetPage(&psp); + loadstringresource(IDS_SCREENOPTION, szTitle, NELEMENTS(szTitle)); + ZeroMemory(&psh, sizeof(psh)); psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_NOAPPLYNOW | PSH_USEHICON | PSH_USECALLBACK; psh.hwndParent = hWnd; - psh.hInstance = hinst; - psh.hIcon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_ICON2)); + psh.hInstance = hInstance; + psh.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON2)); psh.nPages = 4; psh.phpage = hpsp; - psh.pszCaption = str_scropt; + psh.pszCaption = szTitle; psh.pfnCallback = np2class_propetysheet; PropertySheet(&psh); - InvalidateRect(hWndMain, NULL, TRUE); + InvalidateRect(hWnd, NULL, TRUE); }