--- np2/win9x/subwind.cpp 2004/04/08 13:08:22 1.7 +++ np2/win9x/subwind.cpp 2007/11/11 07:11:27 1.15 @@ -20,7 +20,7 @@ static void wintypechange(HWND hWnd, UIN WINLOCEX wlex; - wlex = np2_winlocexallwin(hWndMain); + wlex = np2_winlocexallwin(g_hWndMain); winlocex_setholdwnd(wlex, hWnd); np2class_windowtype(hWnd, type); winlocex_move(wlex); @@ -49,28 +49,33 @@ typedef struct { typedef struct { int posx; int posy; - BYTE mode; - BYTE type; + UINT8 mode; + UINT8 type; } KDISPCFG; static KDISPWIN kdispwin; static KDISPCFG kdispcfg; -static const char kdispapp[] = "Key Display"; -static const char kdispclass[] = "NP2-KeyDispWin"; -static const char str_kdclose[] = "&Close"; +static const TCHAR kdisptitle[] = _T("Key Display"); +static const TCHAR kdispclass[] = _T("NP2-KeyDispWin"); +static const TCHAR str_kdclose[] = _T("&Close"); static const UINT32 kdisppal[KEYDISP_PALS] = {0x00000000, 0xffffffff, 0xf9ff0000}; -static const INITBL kdispini[] = { - {"WindposX", INITYPE_SINT32, &kdispcfg.posx, 0}, - {"WindposY", INITYPE_SINT32, &kdispcfg.posy, 0}, - {"keydmode", INITYPE_UINT8, &kdispcfg.mode, 0}, - {"windtype", INITYPE_BOOL, &kdispcfg.type, 0}}; +#if defined(OSLANG_UTF8) +static const OEMCHAR kdispapp[] = OEMTEXT("Key Display"); +#else +#define kdispapp kdisptitle +#endif +static const PFTBL kdispini[] = { + PFVAL("WindposX", PFTYPE_SINT32, &kdispcfg.posx), + PFVAL("WindposY", PFTYPE_SINT32, &kdispcfg.posy), + PFVAL("keydmode", PFTYPE_UINT8, &kdispcfg.mode), + PFVAL("windtype", PFTYPE_BOOL, &kdispcfg.type)}; -static BYTE kdgetpal8(CMNPALFN *self, UINT num) { +static UINT8 kdgetpal8(CMNPALFN *self, UINT num) { if (num < KEYDISP_PALS) { return(kdisppal[num] >> 24); @@ -119,7 +124,7 @@ static void kdsetwinsize(void) { int height; WINLOCEX wlex; - wlex = np2_winlocexallwin(hWndMain); + wlex = np2_winlocexallwin(g_hWndMain); winlocex_setholdwnd(wlex, kdispwin.hwnd); keydisp_getsize(&width, &height); winloc_setclientsize(kdispwin.hwnd, width, height); @@ -127,7 +132,7 @@ static void kdsetwinsize(void) { winlocex_destroy(wlex); } -static void kdsetdispmode(BYTE mode) { +static void kdsetdispmode(UINT8 mode) { HMENU hmenu; @@ -221,7 +226,7 @@ static LRESULT CALLBACK kdproc(HWND hWnd case WM_KEYDOWN: case WM_KEYUP: - SendMessage(hWndMain, msg, wp, lp); + SendMessage(g_hWndMain, msg, wp, lp); break; case WM_ENTERMENULOOP: @@ -278,46 +283,44 @@ static LRESULT CALLBACK kdproc(HWND hWnd return(0L); } -BOOL kdispwin_initialize(HINSTANCE hPreInst) { +BOOL kdispwin_initialize(HINSTANCE hInstance) { WNDCLASS wc; - if (!hPreInst) { - ZeroMemory(&wc, sizeof(wc)); - wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; - wc.lpfnWndProc = kdproc; - wc.cbClsExtra = 0; - wc.cbWndExtra = NP2GWL_SIZE; - wc.hInstance = hInst; - wc.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON2)); - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH); - wc.lpszMenuName = MAKEINTRESOURCE(IDR_KEYDISP); - wc.lpszClassName = kdispclass; - if (!RegisterClass(&wc)) { - return(FAILURE); - } + ZeroMemory(&wc, sizeof(wc)); + wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; + wc.lpfnWndProc = kdproc; + wc.cbClsExtra = 0; + wc.cbWndExtra = NP2GWLP_SIZE; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON2)); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH); + wc.lpszMenuName = MAKEINTRESOURCE(IDR_KEYDISP); + wc.lpszClassName = kdispclass; + if (!RegisterClass(&wc)) { + return(FAILURE); } keydisp_initialize(); return(SUCCESS); } -void kdispwin_create(void) { +void kdispwin_create(HINSTANCE hInstance) { HWND hwnd; - BYTE mode; + UINT8 mode; CMNPALFN palfn; if (kdispwin.hwnd != NULL) { return; } ZeroMemory(&kdispwin, sizeof(kdispwin)); - hwnd = CreateWindow(kdispclass, kdispapp, + hwnd = CreateWindow(kdispclass, kdisptitle, WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX, kdispcfg.posx, kdispcfg.posy, - CW_USEDEFAULT, CW_USEDEFAULT, - NULL, NULL, hInst, NULL); + KEYDISP_WIDTH, KEYDISP_HEIGHT, + NULL, NULL, hInstance, NULL); kdispwin.hwnd = hwnd; if (hwnd == NULL) { goto kdcre_err1; @@ -345,7 +348,7 @@ void kdispwin_create(void) { palfn.userdata = (long)kdispwin.dd2hdl; keydisp_setpal(&palfn); kdispwin_draw(0); - SetForegroundWindow(hWndMain); + SetForegroundWindow(g_hWndMain); return; kdcre_err2: @@ -368,9 +371,9 @@ HWND kdispwin_gethwnd(void) { return(kdispwin.hwnd); } -void kdispwin_draw(BYTE cnt) { +void kdispwin_draw(UINT8 cnt) { - BYTE flag; + UINT8 flag; if (kdispwin.hwnd) { if (!cnt) { @@ -386,21 +389,21 @@ void kdispwin_draw(BYTE cnt) { void kdispwin_readini(void) { - char path[MAX_PATH]; + OEMCHAR path[MAX_PATH]; ZeroMemory(&kdispcfg, sizeof(kdispcfg)); kdispcfg.posx = CW_USEDEFAULT; kdispcfg.posy = CW_USEDEFAULT; - initgetfile(path, sizeof(path)); - ini_read(path, kdispapp, kdispini, sizeof(kdispini)/sizeof(INITBL)); + initgetfile(path, NELEMENTS(path)); + ini_read(path, kdispapp, kdispini, NELEMENTS(kdispini)); } void kdispwin_writeini(void) { - char path[MAX_PATH]; + OEMCHAR path[MAX_PATH]; - initgetfile(path, sizeof(path)); - ini_write(path, kdispapp, kdispini, sizeof(kdispini)/sizeof(INITBL)); + initgetfile(path, NELEMENTS(path)); + ini_write(path, kdispapp, kdispini, NELEMENTS(kdispini)); } #endif @@ -426,12 +429,18 @@ typedef struct { static MDBGWIN mdbgwin; static MDBGCFG mdbgcfg; -static const char mdbgapp[] = "Memory Map"; -static const char mdbgclass[] = "NP2-MemDbgWin"; -static const INITBL mdbgini[] = { - {"WindposX", INITYPE_SINT32, &mdbgcfg.posx, 0}, - {"WindposY", INITYPE_SINT32, &mdbgcfg.posy, 0}, - {"windtype", INITYPE_BOOL, &mdbgcfg.type, 0}}; +static const TCHAR mdbgtitle[] = _T("Memory Map"); +static const TCHAR mdbgclass[] = _T("NP2-MemDbgWin"); + +#if defined(OSLANG_UTF8) +static const OEMCHAR mdbgapp[] = OEMTEXT("Memory Map"); +#else +#define mdbgapp mdbgtitle +#endif +static const PFTBL mdbgini[] = { + PFVAL("WindposX", PFTYPE_SINT32, &mdbgcfg.posx), + PFVAL("WindposY", PFTYPE_SINT32, &mdbgcfg.posy), + PFVAL("windtype", PFTYPE_BOOL, &mdbgcfg.type)}; static void mdpalcnv(CMNPAL *dst, const RGB32 *src, UINT pals, UINT bpp) { @@ -439,11 +448,25 @@ static void mdpalcnv(CMNPAL *dst, const UINT i; switch(bpp) { +#if defined(SUPPORT_16BPP) + case 16: + for (i=0; i