| version 1.12, 2005/03/20 06:09:16 | version 1.16, 2007/11/11 13:54:14 | 
| Line 20  static void wintypechange(HWND hWnd, UIN | Line 20  static void wintypechange(HWND hWnd, UIN | 
 |  |  | 
 | WINLOCEX        wlex; | WINLOCEX        wlex; | 
 |  |  | 
| wlex = np2_winlocexallwin(hWndMain); | wlex = np2_winlocexallwin(g_hWndMain); | 
 | winlocex_setholdwnd(wlex, hWnd); | winlocex_setholdwnd(wlex, hWnd); | 
 | np2class_windowtype(hWnd, type); | np2class_windowtype(hWnd, type); | 
 | winlocex_move(wlex); | winlocex_move(wlex); | 
| Line 56  typedef struct { | Line 56  typedef struct { | 
 | static  KDISPWIN        kdispwin; | static  KDISPWIN        kdispwin; | 
 | static  KDISPCFG        kdispcfg; | static  KDISPCFG        kdispcfg; | 
 |  |  | 
| static const OEMCHAR kdispapp[] = OEMTEXT("Key Display"); | static const TCHAR kdisptitle[] = _T("Key Display"); | 
| static const OEMCHAR kdispclass[] = OEMTEXT("NP2-KeyDispWin"); | static const TCHAR kdispclass[] = _T("NP2-KeyDispWin"); | 
| static const OEMCHAR str_kdclose[] = OEMTEXT("&Close"); | static const TCHAR str_kdclose[] = _T("&Close"); | 
 |  |  | 
 | static const UINT32 kdisppal[KEYDISP_PALS] = | static const UINT32 kdisppal[KEYDISP_PALS] = | 
 | {0x00000000, 0xffffffff, 0xf9ff0000}; | {0x00000000, 0xffffffff, 0xf9ff0000}; | 
 |  |  | 
 |  | #if defined(OSLANG_UTF8) | 
 |  | static const OEMCHAR kdispapp[] = OEMTEXT("Key Display"); | 
 |  | #else | 
 |  | #define kdispapp        kdisptitle | 
 |  | #endif | 
 | static const PFTBL kdispini[] = { | static const PFTBL kdispini[] = { | 
 | PFVAL("WindposX", PFTYPE_SINT32,        &kdispcfg.posx), | PFVAL("WindposX", PFTYPE_SINT32,        &kdispcfg.posx), | 
 | PFVAL("WindposY", PFTYPE_SINT32,        &kdispcfg.posy), | PFVAL("WindposY", PFTYPE_SINT32,        &kdispcfg.posy), | 
| Line 119  static void kdsetwinsize(void) { | Line 124  static void kdsetwinsize(void) { | 
 | int                     height; | int                     height; | 
 | WINLOCEX        wlex; | WINLOCEX        wlex; | 
 |  |  | 
| wlex = np2_winlocexallwin(hWndMain); | wlex = np2_winlocexallwin(g_hWndMain); | 
 | winlocex_setholdwnd(wlex, kdispwin.hwnd); | winlocex_setholdwnd(wlex, kdispwin.hwnd); | 
 | keydisp_getsize(&width, &height); | keydisp_getsize(&width, &height); | 
 | winloc_setclientsize(kdispwin.hwnd, width, height); | winloc_setclientsize(kdispwin.hwnd, width, height); | 
| Line 221  static LRESULT CALLBACK kdproc(HWND hWnd | Line 226  static LRESULT CALLBACK kdproc(HWND hWnd | 
 |  |  | 
 | case WM_KEYDOWN: | case WM_KEYDOWN: | 
 | case WM_KEYUP: | case WM_KEYUP: | 
| SendMessage(hWndMain, msg, wp, lp); | SendMessage(g_hWndMain, msg, wp, lp); | 
 | break; | break; | 
 |  |  | 
 | case WM_ENTERMENULOOP: | case WM_ENTERMENULOOP: | 
| Line 278  static LRESULT CALLBACK kdproc(HWND hWnd | Line 283  static LRESULT CALLBACK kdproc(HWND hWnd | 
 | return(0L); | return(0L); | 
 | } | } | 
 |  |  | 
| BOOL kdispwin_initialize(HINSTANCE hPreInst) { | BOOL kdispwin_initialize(HINSTANCE hInstance) { | 
 |  |  | 
 | WNDCLASS        wc; | WNDCLASS        wc; | 
 |  |  | 
| if (!hPreInst) { | ZeroMemory(&wc, sizeof(wc)); | 
| ZeroMemory(&wc, sizeof(wc)); | wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; | 
| wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; | wc.lpfnWndProc = kdproc; | 
| wc.lpfnWndProc = kdproc; | wc.cbClsExtra = 0; | 
| wc.cbClsExtra = 0; | wc.cbWndExtra = NP2GWLP_SIZE; | 
| wc.cbWndExtra = NP2GWL_SIZE; | wc.hInstance = hInstance; | 
| wc.hInstance = hInst; | wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON2)); | 
| wc.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON2)); | wc.hCursor = LoadCursor(NULL, IDC_ARROW); | 
| wc.hCursor = LoadCursor(NULL, IDC_ARROW); | wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH); | 
| wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH); | wc.lpszMenuName = MAKEINTRESOURCE(IDR_KEYDISP); | 
| wc.lpszMenuName = MAKEINTRESOURCE(IDR_KEYDISP); | wc.lpszClassName = kdispclass; | 
| wc.lpszClassName = kdispclass; | if (!RegisterClass(&wc)) { | 
| if (!RegisterClass(&wc)) { | return(FAILURE); | 
| return(FAILURE); |  | 
| } |  | 
 | } | } | 
 | keydisp_initialize(); | keydisp_initialize(); | 
 | return(SUCCESS); | return(SUCCESS); | 
 | } | } | 
 |  |  | 
| void kdispwin_create(void) { | void kdispwin_create(HINSTANCE hInstance) { | 
 |  |  | 
 | HWND            hwnd; | HWND            hwnd; | 
 | UINT8           mode; | UINT8           mode; | 
| Line 312  void kdispwin_create(void) { | Line 315  void kdispwin_create(void) { | 
 | return; | return; | 
 | } | } | 
 | ZeroMemory(&kdispwin, sizeof(kdispwin)); | ZeroMemory(&kdispwin, sizeof(kdispwin)); | 
| hwnd = CreateWindow(kdispclass, kdispapp, | hwnd = CreateWindow(kdispclass, kdisptitle, | 
 | WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | | WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | | 
 | WS_MINIMIZEBOX, | WS_MINIMIZEBOX, | 
 | kdispcfg.posx, kdispcfg.posy, | kdispcfg.posx, kdispcfg.posy, | 
 | KEYDISP_WIDTH, KEYDISP_HEIGHT, | KEYDISP_WIDTH, KEYDISP_HEIGHT, | 
| NULL, NULL, hInst, NULL); | NULL, NULL, hInstance, NULL); | 
 | kdispwin.hwnd = hwnd; | kdispwin.hwnd = hwnd; | 
 | if (hwnd == NULL) { | if (hwnd == NULL) { | 
 | goto kdcre_err1; | goto kdcre_err1; | 
| Line 345  void kdispwin_create(void) { | Line 348  void kdispwin_create(void) { | 
 | palfn.userdata = (long)kdispwin.dd2hdl; | palfn.userdata = (long)kdispwin.dd2hdl; | 
 | keydisp_setpal(&palfn); | keydisp_setpal(&palfn); | 
 | kdispwin_draw(0); | kdispwin_draw(0); | 
| SetForegroundWindow(hWndMain); | SetForegroundWindow(g_hWndMain); | 
 | return; | return; | 
 |  |  | 
 | kdcre_err2: | kdcre_err2: | 
| Line 426  typedef struct { | Line 429  typedef struct { | 
 | static  MDBGWIN         mdbgwin; | static  MDBGWIN         mdbgwin; | 
 | static  MDBGCFG         mdbgcfg; | static  MDBGCFG         mdbgcfg; | 
 |  |  | 
 |  | 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"); | static const OEMCHAR mdbgapp[] = OEMTEXT("Memory Map"); | 
| static const OEMCHAR mdbgclass[] = OEMTEXT("NP2-MemDbgWin"); | #else | 
| static const INITBL mdbgini[] = { | #define mdbgapp         mdbgtitle | 
|  | #endif | 
|  | static const PFTBL mdbgini[] = { | 
 | PFVAL("WindposX", PFTYPE_SINT32,        &mdbgcfg.posx), | PFVAL("WindposX", PFTYPE_SINT32,        &mdbgcfg.posx), | 
 | PFVAL("WindposY", PFTYPE_SINT32,        &mdbgcfg.posy), | PFVAL("WindposY", PFTYPE_SINT32,        &mdbgcfg.posy), | 
 | PFVAL("windtype", PFTYPE_BOOL,          &mdbgcfg.type)}; | PFVAL("windtype", PFTYPE_BOOL,          &mdbgcfg.type)}; | 
| Line 511  static LRESULT CALLBACK mdproc(HWND hWnd | Line 520  static LRESULT CALLBACK mdproc(HWND hWnd | 
 | mdpaintmsg(hWnd); | mdpaintmsg(hWnd); | 
 | break; | break; | 
 |  |  | 
 |  | case WM_LBUTTONDOWN: | 
 |  | if (mdbgcfg.type & 1) { | 
 |  | return(SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0L)); | 
 |  | } | 
 |  | break; | 
 |  |  | 
 |  | case WM_LBUTTONDBLCLK: | 
 |  | mdbgcfg.type ^= 1; | 
 |  | wintypechange(hWnd, (mdbgcfg.type & 1) + 1); | 
 |  | sysmng_update(SYS_UPDATEOSCFG); | 
 |  | break; | 
 |  |  | 
 | case WM_KEYDOWN: | case WM_KEYDOWN: | 
 | case WM_KEYUP: | case WM_KEYUP: | 
| SendMessage(hWndMain, msg, wp, lp); | SendMessage(g_hWndMain, msg, wp, lp); | 
 | break; | break; | 
 |  |  | 
 | case WM_ENTERMENULOOP: | case WM_ENTERMENULOOP: | 
| Line 571  BOOL mdbgwin_initialize(HINSTANCE hInsta | Line 592  BOOL mdbgwin_initialize(HINSTANCE hInsta | 
 |  |  | 
 | WNDCLASS        wc; | WNDCLASS        wc; | 
 |  |  | 
| wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW; | wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; | 
 | wc.lpfnWndProc = mdproc; | wc.lpfnWndProc = mdproc; | 
 | wc.cbClsExtra = 0; | wc.cbClsExtra = 0; | 
 | wc.cbWndExtra = 0; | wc.cbWndExtra = 0; | 
 | wc.hInstance = hInstance; | wc.hInstance = hInstance; | 
| wc.hIcon = NULL; | wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON2)); | 
 | wc.hCursor = LoadCursor(NULL, IDC_ARROW); | wc.hCursor = LoadCursor(NULL, IDC_ARROW); | 
 | wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH); | wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH); | 
 | wc.lpszMenuName = NULL; | wc.lpszMenuName = NULL; | 
| Line 588  BOOL mdbgwin_initialize(HINSTANCE hInsta | Line 609  BOOL mdbgwin_initialize(HINSTANCE hInsta | 
 | return(SUCCESS); | return(SUCCESS); | 
 | } | } | 
 |  |  | 
| void mdbgwin_create(void) { | void mdbgwin_create(HINSTANCE hInstance) { | 
 |  |  | 
| HWND    hwnd; | HWND    hWnd; | 
 |  |  | 
 | if (mdbgwin.hwnd != NULL) { | if (mdbgwin.hwnd != NULL) { | 
 | return; | return; | 
 | } | } | 
 | ZeroMemory(&mdbgwin, sizeof(mdbgwin)); | ZeroMemory(&mdbgwin, sizeof(mdbgwin)); | 
 | memdbg32_getsize(&mdbgwin.width, &mdbgwin.height); | memdbg32_getsize(&mdbgwin.width, &mdbgwin.height); | 
| hwnd = CreateWindow(mdbgclass, mdbgapp, | hWnd = CreateWindow(mdbgclass, mdbgtitle, | 
 | WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | | WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | | 
 | WS_MINIMIZEBOX, | WS_MINIMIZEBOX, | 
 | mdbgcfg.posx, mdbgcfg.posy, | mdbgcfg.posx, mdbgcfg.posy, | 
 | mdbgwin.width, mdbgwin.height, | mdbgwin.width, mdbgwin.height, | 
| NULL, NULL, hInst, NULL); | NULL, NULL, hInstance, NULL); | 
| mdbgwin.hwnd = hwnd; | mdbgwin.hwnd = hWnd; | 
| if (hwnd == NULL) { | if (hWnd == NULL) { | 
 | goto mdcre_err1; | goto mdcre_err1; | 
 | } | } | 
| ShowWindow(hwnd, SW_SHOWNOACTIVATE); | ShowWindow(hWnd, SW_SHOWNOACTIVATE); | 
| UpdateWindow(hwnd); | UpdateWindow(hWnd); | 
| mdbgwin.dd2hdl = dd2_create(hwnd, mdbgwin.width, mdbgwin.height); | mdbgwin.dd2hdl = dd2_create(hWnd, mdbgwin.width, mdbgwin.height); | 
 | if (mdbgwin.dd2hdl == NULL) { | if (mdbgwin.dd2hdl == NULL) { | 
 | goto mdcre_err2; | goto mdcre_err2; | 
 | } | } | 
| InvalidateRect(hwnd, NULL, TRUE); | InvalidateRect(hWnd, NULL, TRUE); | 
| SetForegroundWindow(hWndMain); | SetForegroundWindow(g_hWndMain); | 
 | return; | return; | 
 |  |  | 
 | mdcre_err2: | mdcre_err2: | 
| DestroyWindow(hwnd); | DestroyWindow(hWnd); | 
 |  |  | 
 | mdcre_err1: | mdcre_err1: | 
 | return; | return; | 
| Line 683  typedef struct { | Line 704  typedef struct { | 
 | static  SKBDWIN         skbdwin; | static  SKBDWIN         skbdwin; | 
 | static  SKBDCFG         skbdcfg; | static  SKBDCFG         skbdcfg; | 
 |  |  | 
 |  | static const TCHAR skbdtitle[] = _T("Soft Keyboard"); | 
 |  | static const TCHAR skbdclass[] = _T("NP2-SoftKBDWin"); | 
 |  |  | 
 |  | #if defined(OSLANG_UTF8) | 
 | static const OEMCHAR skbdapp[] = OEMTEXT("Soft Keyboard"); | static const OEMCHAR skbdapp[] = OEMTEXT("Soft Keyboard"); | 
| static const OEMCHAR skbdclass[] = OEMTEXT("NP2-SoftKBDWin"); | #else | 
|  | #define skbdapp         skbdtitle | 
|  | #endif | 
 | static const PFTBL skbdini[] = { | static const PFTBL skbdini[] = { | 
 | PFVAL("WindposX", PFTYPE_SINT32,        &skbdcfg.posx), | PFVAL("WindposX", PFTYPE_SINT32,        &skbdcfg.posx), | 
 | PFVAL("WindposY", PFTYPE_SINT32,        &skbdcfg.posy), | PFVAL("WindposY", PFTYPE_SINT32,        &skbdcfg.posy), | 
| Line 780  static LRESULT CALLBACK skproc(HWND hWnd | Line 807  static LRESULT CALLBACK skproc(HWND hWnd | 
 |  |  | 
 | case WM_KEYDOWN: | case WM_KEYDOWN: | 
 | case WM_KEYUP: | case WM_KEYUP: | 
| SendMessage(hWndMain, msg, wp, lp); | SendMessage(g_hWndMain, msg, wp, lp); | 
 | break; | break; | 
 |  |  | 
 | case WM_ENTERMENULOOP: | case WM_ENTERMENULOOP: | 
| Line 834  static LRESULT CALLBACK skproc(HWND hWnd | Line 861  static LRESULT CALLBACK skproc(HWND hWnd | 
 | return(0L); | return(0L); | 
 | } | } | 
 |  |  | 
| BOOL skbdwin_initialize(HINSTANCE hPreInst) { | BOOL skbdwin_initialize(HINSTANCE hInstance) { | 
 |  |  | 
 | WNDCLASS        wc; | WNDCLASS        wc; | 
 |  |  | 
| if (!hPreInst) { | ZeroMemory(&wc, sizeof(wc)); | 
| ZeroMemory(&wc, sizeof(wc)); | wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; | 
| wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; | wc.lpfnWndProc = skproc; | 
| wc.lpfnWndProc = skproc; | wc.cbClsExtra = 0; | 
| wc.cbClsExtra = 0; | wc.cbWndExtra = NP2GWLP_SIZE; | 
| wc.cbWndExtra = NP2GWL_SIZE; | wc.hInstance = hInstance; | 
| wc.hInstance = hInst; | wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON2)); | 
| wc.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON2)); | wc.hCursor = LoadCursor(NULL, IDC_ARROW); | 
| wc.hCursor = LoadCursor(NULL, IDC_ARROW); | wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH); | 
| wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH); | wc.lpszMenuName = NULL; | 
| wc.lpszMenuName = NULL; | wc.lpszClassName = skbdclass; | 
| wc.lpszClassName = skbdclass; | if (!RegisterClass(&wc)) { | 
| if (!RegisterClass(&wc)) { | return(FAILURE); | 
| return(FAILURE); |  | 
| } |  | 
 | } | } | 
 | softkbd_initialize(); | softkbd_initialize(); | 
 | return(SUCCESS); | return(SUCCESS); | 
| Line 863  void skbdwin_deinitialize(void) { | Line 888  void skbdwin_deinitialize(void) { | 
 | softkbd_deinitialize(); | softkbd_deinitialize(); | 
 | } | } | 
 |  |  | 
| void skbdwin_create(void) { | void skbdwin_create(HINSTANCE hInstance) { | 
 |  |  | 
 | HWND    hwnd; | HWND    hwnd; | 
 |  |  | 
| Line 874  void skbdwin_create(void) { | Line 899  void skbdwin_create(void) { | 
 | if (softkbd_getsize(&skbdwin.width, &skbdwin.height) != SUCCESS) { | if (softkbd_getsize(&skbdwin.width, &skbdwin.height) != SUCCESS) { | 
 | return; | return; | 
 | } | } | 
| hwnd = CreateWindow(skbdclass, skbdapp, | hwnd = CreateWindow(skbdclass, skbdtitle, | 
 | WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | | WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | | 
 | WS_MINIMIZEBOX, | WS_MINIMIZEBOX, | 
 | skbdcfg.posx, skbdcfg.posy, | skbdcfg.posx, skbdcfg.posy, | 
 | skbdwin.width, skbdwin.height, | skbdwin.width, skbdwin.height, | 
| NULL, NULL, hInst, NULL); | NULL, NULL, hInstance, NULL); | 
 | skbdwin.hwnd = hwnd; | skbdwin.hwnd = hwnd; | 
 | if (hwnd == NULL) { | if (hwnd == NULL) { | 
 | goto skcre_err1; | goto skcre_err1; | 
| Line 891  void skbdwin_create(void) { | Line 916  void skbdwin_create(void) { | 
 | goto skcre_err2; | goto skcre_err2; | 
 | } | } | 
 | InvalidateRect(hwnd, NULL, TRUE); | InvalidateRect(hwnd, NULL, TRUE); | 
| SetForegroundWindow(hWndMain); | SetForegroundWindow(g_hWndMain); | 
 | return; | return; | 
 |  |  | 
 | skcre_err2: | skcre_err2: |