|
|
| version 1.13, 2003/11/04 15:44:59 | version 1.25, 2007/12/28 20:36:40 |
|---|---|
| Line 3 | Line 3 |
| #include "resource.h" | #include "resource.h" |
| #include "np2.h" | #include "np2.h" |
| #include "winloc.h" | #include "winloc.h" |
| #include "oemtext.h" | |
| #include "dosio.h" | #include "dosio.h" |
| #include "soundmng.h" | #include "soundmng.h" |
| #include "sysmng.h" | #include "sysmng.h" |
| Line 33 enum { | Line 34 enum { |
| IDC_TOOLPOWER, | IDC_TOOLPOWER, |
| IDC_MAXITEMS, | IDC_MAXITEMS, |
| IDC_BASE = 3000, | IDC_BASE = 3000 |
| IDM_SKINSEL = 3100, | |
| IDM_SKINDEF = 3101, | |
| IDM_SKINMRU = 3102, | |
| IDM_TOOLCLOSE = IDM_SKINMRU + SKINMRU_MAX | |
| }; | }; |
| enum { | enum { |
| Line 48 enum { | Line 44 enum { |
| }; | }; |
| typedef struct { | typedef struct { |
| char main[MAX_PATH]; | OEMCHAR main[MAX_PATH]; |
| char font[64]; | OEMCHAR font[64]; |
| SINT32 fontsize; | SINT32 fontsize; |
| UINT32 color1; | UINT32 color1; |
| UINT32 color2; | UINT32 color2; |
| } TOOLSKIN; | } TOOLSKIN; |
| typedef struct { | typedef struct { |
| UINT tctl; | UINT tctl; |
| const char *text; | const OEMCHAR *text; |
| short posx; | short posx; |
| short posy; | short posy; |
| short width; | short width; |
| short height; | short height; |
| short extend; | short extend; |
| short padding; | short padding; |
| } SUBITEM; | } SUBITEM; |
| typedef struct { | typedef struct { |
| HWND hwnd; | HWND hwnd; |
| WINLOCEX wlex; | WINLOCEX wlex; |
| HBITMAP hbmp; | HBITMAP hbmp; |
| BYTE fddaccess[2]; | UINT8 fddaccess[2]; |
| BYTE hddaccess; | UINT8 hddaccess; |
| BYTE _padding; | UINT8 _padding; |
| int winflg; | int winflg; |
| int wingx; | int wingx; |
| int wingy; | int wingy; |
| Line 88 typedef struct { | Line 84 typedef struct { |
| SUBCLASSPROC subproc[IDC_MAXITEMS]; | SUBCLASSPROC subproc[IDC_MAXITEMS]; |
| } TOOLWIN; | } TOOLWIN; |
| enum { | #define GTWLP_FOCUS (NP2GWLP_SIZE + (0 * sizeof(LONG_PTR))) |
| GTWL_FOCUS = NP2GWL_SIZE + 0, | #define GTWLP_SIZE (NP2GWLP_SIZE + (1 * sizeof(LONG_PTR))) |
| GTWL_SIZE = NP2GWL_SIZE + 4 | |
| }; | |
| NP2TOOL np2tool; | NP2TOOL np2tool; |
| static TOOLSKIN toolskin; | static TOOLSKIN toolskin; |
| Line 102 static TOOLWIN toolwin; | Line 96 static TOOLWIN toolwin; |
| typedef struct { | typedef struct { |
| WORD idc; | UINT16 idc; |
| BYTE *counter; | UINT8 *counter; |
| } DISKACC; | } DISKACC; |
| static const BYTE fddlist[FDDLIST_DRV] = { | static const UINT8 fddlist[FDDLIST_DRV] = { |
| IDC_TOOLFDD1LIST, IDC_TOOLFDD2LIST}; | IDC_TOOLFDD1LIST, IDC_TOOLFDD2LIST}; |
| static const DISKACC diskacc[3] = { | static const DISKACC diskacc[3] = { |
| Line 117 static const DISKACC diskacc[3] = { | Line 111 static const DISKACC diskacc[3] = { |
| // ---- | // ---- |
| static HBITMAP skinload(const char *path) { | static HBITMAP skinload(const OEMCHAR *path) { |
| char fname[MAX_PATH]; | OEMCHAR fname[MAX_PATH]; |
| UINT i; | UINT i; |
| HBITMAP ret; | HBITMAP ret; |
| ZeroMemory(&toolskin, sizeof(toolskin)); | ZeroMemory(&toolskin, sizeof(toolskin)); |
| toolskin.fontsize = 12; | toolskin.fontsize = 12; |
| milstr_ncpy(toolskin.font, str_deffont, sizeof(toolskin.font)); | milstr_ncpy(toolskin.font, str_deffont, NELEMENTS(toolskin.font)); |
| toolskin.color1 = 0x600000; | toolskin.color1 = 0x600000; |
| toolskin.color2 = 0xff0000; | toolskin.color2 = 0xff0000; |
| if (path) { | if (path) { |
| ini_read(path, skintitle, skinini1, sizeof(skinini1)/sizeof(INITBL)); | ini_read(path, skintitle, skinini1, NELEMENTS(skinini1)); |
| } | } |
| if (toolskin.main[0]) { | if (toolskin.main[0]) { |
| ZeroMemory(subitem, sizeof(defsubitem)); | ZeroMemory(subitem, sizeof(defsubitem)); |
| Line 142 static HBITMAP skinload(const char *path | Line 136 static HBITMAP skinload(const char *path |
| CopyMemory(subitem, defsubitem, sizeof(defsubitem)); | CopyMemory(subitem, defsubitem, sizeof(defsubitem)); |
| } | } |
| if (path) { | if (path) { |
| ini_read(path, skintitle, skinini2, sizeof(skinini2)/sizeof(INITBL)); | ini_read(path, skintitle, skinini2, NELEMENTS(skinini2)); |
| } | } |
| if (toolskin.main[0]) { | if (toolskin.main[0]) { |
| milstr_ncpy(fname, path, sizeof(fname)); | milstr_ncpy(fname, path, NELEMENTS(fname)); |
| file_cutname(fname); | file_cutname(fname); |
| file_catname(fname, toolskin.main, sizeof(fname)); | file_catname(fname, toolskin.main, NELEMENTS(fname)); |
| ret = (HBITMAP)LoadImage(hInst, fname, IMAGE_BITMAP, | #if defined(OSLANG_UTF8) |
| TCHAR tchr[MAX_PATH]; | |
| oemtotchar(tchr, NELEMENTS(tchr), fname, -1); | |
| #else | |
| const TCHAR *tchr = fname; | |
| #endif | |
| ret = (HBITMAP)LoadImage(g_hInstance, tchr, IMAGE_BITMAP, | |
| 0, 0, LR_LOADFROMFILE); | 0, 0, LR_LOADFROMFILE); |
| if (ret != NULL) { | if (ret != NULL) { |
| return(ret); | return(ret); |
| } | } |
| } | } |
| return(LoadBitmap(hInst, "NP2TOOL")); | return(LoadBitmap(g_hInstance, _T("NP2TOOL"))); |
| } | } |
| // ---- | // ---- |
| static void calctextsize(char *path, int leng, const char *p, int width) { | static void calctextsize(OEMCHAR *path, int leng, const OEMCHAR *p, int width) { |
| HDC hdc; | HDC hdc; |
| SIZE cur; | SIZE cur; |
| char work[MAX_PATH]; | OEMCHAR work[MAX_PATH]; |
| int l; | int l; |
| SIZE tail; | SIZE tail; |
| int pos; | int pos; |
| Line 172 static void calctextsize(char *path, int | Line 172 static void calctextsize(char *path, int |
| milstr_ncpy(path, p, leng); | milstr_ncpy(path, p, leng); |
| hdc = toolwin.hdcfont; | hdc = toolwin.hdcfont; |
| GetTextExtentPoint32(hdc, p, strlen(p), &cur); | GetTextExtentPoint32(hdc, p, OEMSTRLEN(p), &cur); |
| if (cur.cx < width) { | if (cur.cx < width) { |
| return; | return; |
| } | } |
| Line 180 static void calctextsize(char *path, int | Line 180 static void calctextsize(char *path, int |
| file_cutname(path); | file_cutname(path); |
| file_cutseparator(path); | file_cutseparator(path); |
| file_cutname(path); | file_cutname(path); |
| l = strlen(path); | file_cutseparator(path); |
| if (l > 1) { | l = OEMSTRLEN(path); |
| l -= 1; | work[0] = '\0'; |
| if (milstr_kanji2nd(p, l - 1)) { | if (l) { |
| l--; | milstr_ncpy(work, str_browse, NELEMENTS(work)); |
| } | |
| } | |
| else { | |
| l = 0; | |
| } | } |
| milstr_ncpy(work, str_browse, sizeof(work)); | milstr_ncat(work, p + l, NELEMENTS(work)); |
| milstr_ncat(work, p + l, sizeof(work)); | GetTextExtentPoint32(hdc, work, OEMSTRLEN(work), &tail); |
| GetTextExtentPoint32(hdc, work, strlen(work), &tail); | |
| pos = 0; | pos = 0; |
| while(pos < l) { | while(pos < l) { |
| step = ((((p[pos] ^ 0x20) - 0xa1) & 0xff) < 0x3c)?2:1; | #if defined(_UNICODE) |
| step = 1; | |
| #else | |
| step = (IsDBCSLeadByte((BYTE)p[pos]))?2:1; | |
| #endif | |
| GetTextExtentPoint32(hdc, p, pos + step, &cur); | GetTextExtentPoint32(hdc, p, pos + step, &cur); |
| if (cur.cx + tail.cx >= width) { | if (cur.cx + tail.cx >= width) { |
| break; | break; |
| Line 210 static void calctextsize(char *path, int | Line 209 static void calctextsize(char *path, int |
| static void setlist(HWND hwnd, const TOOLFDD *fdd, UINT sel) { | static void setlist(HWND hwnd, const TOOLFDD *fdd, UINT sel) { |
| RECT rc; | RECT rc; |
| int width; | int width; |
| char basedir[MAX_PATH]; | OEMCHAR basedir[MAX_PATH]; |
| UINT i; | UINT i; |
| const char *p; | const OEMCHAR *p; |
| char dir[MAX_PATH]; | OEMCHAR dir[MAX_PATH]; |
| const char *q; | const OEMCHAR *q; |
| SendMessage(hwnd, CB_RESETCONTENT, (WPARAM)0, (LPARAM)0); | SendMessage(hwnd, CB_RESETCONTENT, (WPARAM)0, (LPARAM)0); |
| GetClientRect(hwnd, &rc); | GetClientRect(hwnd, &rc); |
| width = rc.right - rc.left - 6; // border size? | width = rc.right - rc.left - 6; // border size? |
| basedir[0] = '\0'; | basedir[0] = '\0'; |
| if (sel < fdd->cnt) { | if (sel < fdd->cnt) { |
| milstr_ncpy(basedir, fdd->name[fdd->pos[sel]], sizeof(basedir)); | milstr_ncpy(basedir, fdd->name[fdd->pos[sel]], NELEMENTS(basedir)); |
| file_cutname(basedir); | file_cutname(basedir); |
| } | } |
| for (i=0; i<fdd->cnt; i++) { | for (i=0; i<fdd->cnt; i++) { |
| p = fdd->name[fdd->pos[i]]; | p = fdd->name[fdd->pos[i]]; |
| milstr_ncpy(dir, p, sizeof(dir)); | milstr_ncpy(dir, p, NELEMENTS(dir)); |
| file_cutname(dir); | file_cutname(dir); |
| if (!file_cmpname(basedir, dir)) { | if (!file_cmpname(basedir, dir)) { |
| q = file_getname((char *)p); | q = file_getname(p); |
| } | } |
| else { | else { |
| calctextsize(dir, sizeof(dir), p, width); | calctextsize(dir, NELEMENTS(dir), p, width); |
| q = dir; | q = dir; |
| } | } |
| SendMessage(hwnd, CB_INSERTSTRING, (WPARAM)i, (LPARAM)q); | SendMessage(hwnd, CB_INSERTSTRING, (WPARAM)i, (LPARAM)q); |
| p += sizeof(fdd->name[0]); | p += NELEMENTS(fdd->name[0]); |
| } | } |
| if (sel < fdd->cnt) { | if (sel < fdd->cnt) { |
| SendMessage(hwnd, CB_SETCURSEL, (WPARAM)sel, (LPARAM)0); | SendMessage(hwnd, CB_SETCURSEL, (WPARAM)sel, (LPARAM)0); |
| Line 266 static void sellist(UINT drv) { | Line 265 static void sellist(UINT drv) { |
| static void remakefddlist(HWND hwnd, TOOLFDD *fdd) { | static void remakefddlist(HWND hwnd, TOOLFDD *fdd) { |
| char *p; | OEMCHAR *p; |
| UINT cnt; | UINT cnt; |
| char *q; | OEMCHAR *q; |
| char *fname[FDDLIST_MAX]; | OEMCHAR *fname[FDDLIST_MAX]; |
| UINT i; | UINT i; |
| UINT j; | UINT j; |
| UINT sel; | UINT sel; |
| Line 290 static void remakefddlist(HWND hwnd, TOO | Line 289 static void remakefddlist(HWND hwnd, TOO |
| fdd->pos[j] = fdd->pos[j-1]; | fdd->pos[j] = fdd->pos[j-1]; |
| } | } |
| fdd->pos[i] = cnt; | fdd->pos[i] = cnt; |
| p += sizeof(fdd->name[0]); | p += NELEMENTS(fdd->name[0]); |
| } | } |
| fdd->cnt = cnt; | fdd->cnt = cnt; |
| sel = (UINT)-1; | sel = (UINT)-1; |
| Line 305 static void remakefddlist(HWND hwnd, TOO | Line 304 static void remakefddlist(HWND hwnd, TOO |
| setlist(hwnd, fdd, sel); | setlist(hwnd, fdd, sel); |
| } | } |
| static void accdraw(HWND hWnd, BYTE count) { | static void accdraw(HWND hWnd, UINT8 count) { |
| HDC hdc; | HDC hdc; |
| PAINTSTRUCT ps; | PAINTSTRUCT ps; |
| Line 326 static LRESULT CALLBACK twsub(HWND hWnd, | Line 325 static LRESULT CALLBACK twsub(HWND hWnd, |
| int dir; | int dir; |
| UINT newidc; | UINT newidc; |
| int files; | int files; |
| char fname[MAX_PATH]; | OEMCHAR fname[MAX_PATH]; |
| idc = GetWindowLong(hWnd, GWL_ID) - IDC_BASE; | idc = GetWindowLong(hWnd, GWL_ID) - IDC_BASE; |
| if (idc >= IDC_MAXITEMS) { | if (idc >= IDC_MAXITEMS) { |
| Line 358 static LRESULT CALLBACK twsub(HWND hWnd, | Line 357 static LRESULT CALLBACK twsub(HWND hWnd, |
| else if (msg == WM_DROPFILES) { | else if (msg == WM_DROPFILES) { |
| files = DragQueryFile((HDROP)wp, (UINT)-1, NULL, 0); | files = DragQueryFile((HDROP)wp, (UINT)-1, NULL, 0); |
| if (files == 1) { | if (files == 1) { |
| DragQueryFile((HDROP)wp, 0, fname, sizeof(fname)); | #if defined(OSLANG_UTF8) |
| TCHAR tchr[MAX_PATH]; | |
| DragQueryFile((HDROP)wp, 0, tchr, NELEMENTS(tchr)); | |
| tchartooem(fname, NELEMENTS(fname), tchr, -1); | |
| #else | |
| DragQueryFile((HDROP)wp, 0, fname, NELEMENTS(fname)); | |
| #endif | |
| if (idc == IDC_TOOLFDD1LIST) { | if (idc == IDC_TOOLFDD1LIST) { |
| diskdrv_setfdd(0, fname, 0); | diskdrv_setfdd(0, fname, 0); |
| toolwin_setfdd(0, fname); | toolwin_setfdd(0, fname); |
| Line 386 static LRESULT CALLBACK twsub(HWND hWnd, | Line 391 static LRESULT CALLBACK twsub(HWND hWnd, |
| } | } |
| } | } |
| else if (msg == WM_SETFOCUS) { | else if (msg == WM_SETFOCUS) { |
| SetWindowLong(GetParent(hWnd), GTWL_FOCUS, idc); | SetWindowLongPtr(GetParent(hWnd), GTWLP_FOCUS, idc); |
| } | } |
| return(CallWindowProc(toolwin.subproc[idc], hWnd, msg, wp, lp)); | return(CallWindowProc(toolwin.subproc[idc], hWnd, msg, wp, lp)); |
| } | } |
| static void toolwincreate(HWND hWnd) { | static void toolwincreate(HWND hWnd) { |
| HDC hdc; | #if defined(OSLANG_UTF8) |
| const SUBITEM *p; | TCHAR fontface[64]; |
| UINT i; | oemtotchar(fontface, NELEMENTS(fontface), toolskin.font, -1); |
| HWND sub; | #else |
| const char *cls; | const TCHAR *fontface = toolskin.font; |
| DWORD style; | #endif |
| toolwin.hfont = CreateFont(toolskin.fontsize, 0, 0, 0, 0, 0, 0, 0, | toolwin.hfont = CreateFont(toolskin.fontsize, 0, 0, 0, 0, 0, 0, 0, |
| SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, | SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, |
| DEFAULT_QUALITY, FIXED_PITCH, toolskin.font); | DEFAULT_QUALITY, FIXED_PITCH, fontface); |
| hdc = GetDC(NULL); | HDC hdc = GetDC(NULL); |
| toolwin.hdcfont = CreateCompatibleDC(hdc); | toolwin.hdcfont = CreateCompatibleDC(hdc); |
| ReleaseDC(NULL, hdc); | ReleaseDC(NULL, hdc); |
| SelectObject(toolwin.hdcfont, toolwin.hfont); | SelectObject(toolwin.hdcfont, toolwin.hfont); |
| Line 411 const char *cls; | Line 415 const char *cls; |
| toolwin.access[0] = CreateSolidBrush(0x000060); | toolwin.access[0] = CreateSolidBrush(0x000060); |
| toolwin.access[1] = CreateSolidBrush(0x0000ff); | toolwin.access[1] = CreateSolidBrush(0x0000ff); |
| p = subitem; | const SUBITEM *p = subitem; |
| UINT i; | |
| for (i=0; i<IDC_MAXITEMS; i++) { | for (i=0; i<IDC_MAXITEMS; i++) { |
| sub = NULL; | HWND sub = NULL; |
| cls = NULL; | const TCHAR *cls = NULL; |
| DWORD style; | |
| switch(p->tctl) { | switch(p->tctl) { |
| case TCTL_STATIC: | case TCTL_STATIC: |
| cls = str_static; | cls = str_static; |
| Line 438 const char *cls; | Line 444 const char *cls; |
| break; | break; |
| } | } |
| if ((cls) && (p->width > 0) && (p->height > 0)) { | if ((cls) && (p->width > 0) && (p->height > 0)) { |
| sub = CreateWindow(cls, p->text, WS_CHILD | WS_VISIBLE | style, | #if defined(OSLANG_UTF8) |
| TCHAR ptext[64]; | |
| oemtotchar(ptext, NELEMENTS(ptext), p->text, -1); | |
| #else | |
| const TCHAR *ptext = p->text; | |
| #endif | |
| sub = CreateWindow(cls, ptext, WS_CHILD | WS_VISIBLE | style, | |
| p->posx, p->posy, p->width, p->height, | p->posx, p->posy, p->width, p->height, |
| hWnd, (HMENU)(i + IDC_BASE), hInst, NULL); | hWnd, (HMENU)(i + IDC_BASE), g_hInstance, NULL); |
| } | } |
| toolwin.sub[i] = sub; | toolwin.sub[i] = sub; |
| toolwin.subproc[i] = NULL; | toolwin.subproc[i] = NULL; |
| if (sub) { | if (sub) { |
| toolwin.subproc[i] = (SUBCLASSPROC)GetWindowLong(sub, GWL_WNDPROC); | toolwin.subproc[i] = (SUBCLASSPROC)GetWindowLongPtr(sub, |
| SetWindowLong(sub, GWL_WNDPROC, (LONG)twsub); | GWLP_WNDPROC); |
| SetWindowLongPtr(sub, GWLP_WNDPROC, (LONG_PTR)twsub); | |
| SendMessage(sub, WM_SETFONT, (WPARAM)toolwin.hfont, | SendMessage(sub, WM_SETFONT, (WPARAM)toolwin.hfont, |
| MAKELPARAM(TRUE, 0)); | MAKELPARAM(TRUE, 0)); |
| } | } |
| p++; | p++; |
| } | } |
| for (i=0; i<FDDLIST_DRV; i++) { | for (i=0; i<FDDLIST_DRV; i++) { |
| sub = toolwin.sub[fddlist[i]]; | HWND sub = toolwin.sub[fddlist[i]]; |
| if (sub) { | if (sub) { |
| DragAcceptFiles(sub, TRUE); | DragAcceptFiles(sub, TRUE); |
| remakefddlist(sub, np2tool.fdd + i); | remakefddlist(sub, np2tool.fdd + i); |
| Line 464 const char *cls; | Line 477 const char *cls; |
| break; | break; |
| } | } |
| } | } |
| SetWindowLong(hWnd, GTWL_FOCUS, i); | SetWindowLongPtr(hWnd, GTWLP_FOCUS, i); |
| } | } |
| static void toolwindestroy(void) { | static void toolwindestroy(void) { |
| Line 544 static void tooldrawbutton(HWND hWnd, UI | Line 557 static void tooldrawbutton(HWND hWnd, UI |
| // ---- | // ---- |
| static HMENU createskinmenu(void) { | static void setSkinMruMenu(HMENU hMenu) |
| { | |
| HMENU hmenuSub; | |
| const OEMCHAR *pcszBase; | |
| UINT uCount; | |
| OEMCHAR *pszMru; | |
| const OEMCHAR *pcszMruList[SKINMRU_MAX]; | |
| UINT i; | |
| UINT uID[SKINMRU_MAX]; | |
| UINT j; | |
| UINT uFlag; | |
| HMENU ret; | for (i=0; i<SKINMRU_MAX; i++) |
| UINT cnt; | { |
| const char *base; | DeleteMenu(hMenu, IDM_TOOL_SKINMRU + i, MF_BYCOMMAND); |
| UINT flag; | } |
| char *p; | |
| UINT i; | |
| UINT j; | |
| UINT id[SKINMRU_MAX]; | |
| const char *file[SKINMRU_MAX]; | |
| ret = CreatePopupMenu(); | if (!menu_searchmenu(hMenu, IDM_TOOL_SKINDEF, &hmenuSub, NULL)) |
| AppendMenu(ret, MF_STRING, IDM_SKINSEL, str_skinsel); | { |
| AppendMenu(ret, MF_SEPARATOR, 0, NULL); | return; |
| } | |
| base = np2tool.skin; | |
| flag = (base[0] == '\0')?MF_CHECKED:0; | pcszBase = np2tool.skin; |
| AppendMenu(ret, MF_STRING + flag, IDM_SKINDEF, str_skindef); | |
| for (cnt=0; cnt<SKINMRU_MAX; cnt++) { | CheckMenuItem(hMenu, IDM_TOOL_SKINDEF, MFCHECK(pcszBase[0] == '\0')); |
| p = np2tool.skinmru[cnt]; | |
| if (p[0] == '\0') { | for (uCount=0; uCount<SKINMRU_MAX; uCount++) |
| { | |
| pszMru = np2tool.skinmru[uCount]; | |
| if (pszMru[0] == '\0') | |
| { | |
| break; | break; |
| } | } |
| p = file_getname(p); | pszMru = file_getname(pszMru); |
| for (i=0; i<cnt; i++) { | for (i=0; i<uCount; i++) |
| if (file_cmpname(p, file[id[i]]) < 0) { | { |
| if (file_cmpname(pszMru, pcszMruList[uID[i]]) < 0) | |
| { | |
| break; | break; |
| } | } |
| } | } |
| for (j=cnt; j>i; j--) { | for (j=uCount; j>i; j--) |
| id[j] = id[j-1]; | { |
| } | uID[j] = uID[j-1]; |
| id[i] = cnt; | } |
| file[cnt] = p; | uID[i] = uCount; |
| pcszMruList[uCount] = pszMru; | |
| } | |
| for (i=0; i<uCount; i++) | |
| { | |
| j = uID[i]; | |
| uFlag = MFCHECK(!file_cmpname(pcszBase, np2tool.skinmru[j])); | |
| #if defined(OSLANG_UTF8) | |
| TCHAR szPath[MAX_PATH]; | |
| oemtotchar(szPath, NELEMENTS(szPath), pcszMruList[j], -1); | |
| #else | |
| const TCHAR *szPath = pcszMruList[j]; | |
| #endif | |
| AppendMenu(hmenuSub, MF_STRING + uFlag, IDM_TOOL_SKINMRU + j, szPath); | |
| } | } |
| for (i=0; i<cnt; i++) { | |
| j = id[i]; | |
| flag = (!file_cmpname(base, np2tool.skinmru[j]))?MF_CHECKED:0; | |
| AppendMenu(ret, MF_STRING + flag, IDM_SKINMRU + j, file[j]); | |
| } | |
| return(ret); | |
| } | } |
| static void skinchange(HWND hWnd) { | #if 0 |
| static HMENU createskinmenu(void) | |
| const char *p; | { |
| HMENU hMenu; | |
| const OEMCHAR *pcszBase; | |
| UINT uCount; | |
| OEMCHAR *pszMru; | |
| const OEMCHAR *pcszMruList[SKINMRU_MAX]; | |
| UINT i; | |
| UINT uID[SKINMRU_MAX]; | |
| UINT j; | |
| UINT uFlag; | |
| hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_TOOLWIN)); | |
| pcszBase = np2tool.skin; | |
| CheckMenuItem(hMenu, IDM_TOOL_SKINDEF, MFCHECK(pcszBase[0] == '\0')); | |
| for (uCount=0; uCount<SKINMRU_MAX; uCount++) | |
| { | |
| pszMru = np2tool.skinmru[uCount]; | |
| if (pszMru[0] == '\0') | |
| { | |
| break; | |
| } | |
| pszMru = file_getname(pszMru); | |
| for (i=0; i<uCount; i++) | |
| { | |
| if (!file_cmpname(pszMru, pcszMruList[uID[i]])) | |
| { | |
| break; | |
| } | |
| } | |
| for (j=uCount; j>i; j--) | |
| { | |
| uID[j] = uID[j-1]; | |
| } | |
| uID[i] = uCount; | |
| pcszMruList[uCount] = pszMru; | |
| } | |
| for (i=0; i<uCount; i++) | |
| { | |
| j = uID[i]; | |
| uFlag = MFCHECK(!file_cmpname(pcszBase, np2tool.skinmru[j])); | |
| #if defined(OSLANG_UTF8) | |
| TCHAR szPath[MAX_PATH]; | |
| oemtotchar(szPath, NELEMENTS(szPath), pcszMruList[j], -1); | |
| #else | |
| const TCHAR *szPath = pcszMruList[j]; | |
| #endif | |
| AppendMenu(hMenu, MF_STRING + uFlag, IDM_TOOL_SKINMRU + j, szPath); | |
| } | |
| return hMenu; | |
| } | |
| #endif | |
| static void skinchange(HWND hWnd) | |
| { | |
| const OEMCHAR *p; | |
| UINT i; | UINT i; |
| HBITMAP hbmp; | HBITMAP hbmp; |
| BITMAP bmp; | BITMAP bmp; |
| Line 608 const char *p; | Line 696 const char *p; |
| sizeof(np2tool.skinmru[0])); | sizeof(np2tool.skinmru[0])); |
| i--; | i--; |
| } | } |
| file_cpyname(np2tool.skinmru[0], p, sizeof(np2tool.skinmru[0])); | file_cpyname(np2tool.skinmru[0], p, NELEMENTS(np2tool.skinmru[0])); |
| } | } |
| ModifyMenu(np2class_gethmenu(hWnd), 0, MF_BYPOSITION | MF_POPUP, | setSkinMruMenu(np2class_gethmenu(hWnd)); |
| (UINT)createskinmenu(), str_toolskin); | setSkinMruMenu(GetSystemMenu(hWnd, FALSE)); |
| ModifyMenu(GetSystemMenu(hWnd, FALSE), 0, MF_BYPOSITION | MF_POPUP, | |
| (UINT)createskinmenu(), str_toolskin); | |
| DrawMenuBar(hWnd); | DrawMenuBar(hWnd); |
| sysmng_update(SYS_UPDATEOSCFG); | sysmng_update(SYS_UPDATEOSCFG); |
| wlex = np2_winlocexallwin(hWndMain); | wlex = np2_winlocexallwin(g_hWndMain); |
| winlocex_setholdwnd(wlex, hWnd); | |
| toolwindestroy(); | toolwindestroy(); |
| hbmp = skinload(np2tool.skin); | hbmp = skinload(np2tool.skin); |
| if (hbmp == NULL) { | if (hbmp == NULL) { |
| Line 635 const char *p; | Line 722 const char *p; |
| // ---- | // ---- |
| static void openpopup(HWND hWnd, LPARAM lp) { | static void openpopup(HWND hWnd, LPARAM lp) |
| { | |
| HMENU hMenu; | HMENU hMenu; |
| HMENU mainmenu; | |
| POINT pt; | POINT pt; |
| hMenu = CreatePopupMenu(); | hMenu = CreatePopupMenu(); |
| if (!winui_en) { | if (!winui_en) |
| mainmenu = np2class_gethmenu(hWndMain); | { |
| menu_addmenubar(hMenu, mainmenu); | menu_addmenu(hMenu, 0, np2class_gethmenu(g_hWndMain), FALSE); |
| } | } |
| AppendMenu(hMenu, MF_POPUP, (UINT)createskinmenu(), str_toolskin); | menu_addmenures(hMenu, -1, IDR_TOOLWIN, FALSE); |
| AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); | menu_addmenures(hMenu, -1, IDR_CLOSE, TRUE); |
| AppendMenu(hMenu, MF_STRING, IDM_TOOLCLOSE, str_toolclose); | setSkinMruMenu(hMenu); |
| pt.x = LOWORD(lp); | pt.x = LOWORD(lp); |
| pt.y = HIWORD(lp); | pt.y = HIWORD(lp); |
| ClientToScreen(hWnd, &pt); | ClientToScreen(hWnd, &pt); |
| Line 656 static void openpopup(HWND hWnd, LPARAM | Line 742 static void openpopup(HWND hWnd, LPARAM |
| DestroyMenu(hMenu); | DestroyMenu(hMenu); |
| } | } |
| static LRESULT CALLBACK twproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { | static void toolwin_oncreate(HWND hWnd) |
| { | |
| HMENU hMenu; | |
| int nCount; | |
| HMENU hMenu; | np2class_wmcreate(hWnd); |
| setSkinMruMenu(np2class_gethmenu(hWnd)); | |
| hMenu = GetSystemMenu(hWnd, FALSE); | |
| nCount = menu_addmenures(hMenu, 0, IDR_TOOLWIN, FALSE); | |
| if (nCount) | |
| { | |
| InsertMenu(hMenu, nCount, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); | |
| setSkinMruMenu(hMenu); | |
| } | |
| np2class_windowtype(hWnd, (np2tool.type & 1) << 1); | |
| toolwincreate(hWnd); | |
| } | |
| static LRESULT CALLBACK twproc(HWND hWnd, UINT uMsg, WPARAM wp, LPARAM lp) | |
| { | |
| BOOL r; | BOOL r; |
| UINT idc; | UINT idc; |
| WINLOCEX wlex; | WINLOCEX wlex; |
| switch(msg) { | switch(uMsg) { |
| case WM_CREATE: | case WM_CREATE: |
| np2class_wmcreate(hWnd); | toolwin_oncreate(hWnd); |
| ModifyMenu(np2class_gethmenu(hWnd), 0, MF_BYPOSITION | MF_POPUP, | |
| (UINT)createskinmenu(), str_toolskin); | |
| hMenu = GetSystemMenu(hWnd, FALSE); | |
| InsertMenu(hMenu, 0, MF_BYPOSITION | MF_POPUP, | |
| (UINT)createskinmenu(), str_toolskin); | |
| InsertMenu(hMenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); | |
| np2class_windowtype(hWnd, (np2tool.type & 1) << 1); | |
| toolwincreate(hWnd); | |
| break; | break; |
| case WM_SYSCOMMAND: | case WM_SYSCOMMAND: |
| switch(wp) { | switch(wp) { |
| case IDM_SKINSEL: | case IDM_TOOL_SKINSEL: |
| case IDM_SKINDEF: | case IDM_TOOL_SKINDEF: |
| case IDM_SKINMRU + 0: | case IDM_TOOL_SKINMRU + 0: |
| case IDM_SKINMRU + 1: | case IDM_TOOL_SKINMRU + 1: |
| case IDM_SKINMRU + 2: | case IDM_TOOL_SKINMRU + 2: |
| case IDM_SKINMRU + 3: | case IDM_TOOL_SKINMRU + 3: |
| return(SendMessage(hWnd, WM_COMMAND, wp, lp)); | return(SendMessage(hWnd, WM_COMMAND, wp, lp)); |
| default: | default: |
| return(DefWindowProc(hWnd, msg, wp, lp)); | return(DefWindowProc(hWnd, uMsg, wp, lp)); |
| } | } |
| break; | break; |
| Line 702 static LRESULT CALLBACK twproc(HWND hWnd | Line 798 static LRESULT CALLBACK twproc(HWND hWnd |
| case IDC_BASE + IDC_TOOLFDD1BROWSE: | case IDC_BASE + IDC_TOOLFDD1BROWSE: |
| if (!winui_en) { | if (!winui_en) { |
| SendMessage(hWndMain, WM_COMMAND, IDM_FDD1OPEN, 0); | SendMessage(g_hWndMain, WM_COMMAND, IDM_FDD1OPEN, 0); |
| } | } |
| break; | break; |
| Line 719 static LRESULT CALLBACK twproc(HWND hWnd | Line 815 static LRESULT CALLBACK twproc(HWND hWnd |
| case IDC_BASE + IDC_TOOLFDD2BROWSE: | case IDC_BASE + IDC_TOOLFDD2BROWSE: |
| if (!winui_en) { | if (!winui_en) { |
| SendMessage(hWndMain, WM_COMMAND, IDM_FDD2OPEN, 0); | SendMessage(g_hWndMain, WM_COMMAND, IDM_FDD2OPEN, 0); |
| } | } |
| break; | break; |
| Line 730 static LRESULT CALLBACK twproc(HWND hWnd | Line 826 static LRESULT CALLBACK twproc(HWND hWnd |
| case IDC_BASE + IDC_TOOLRESET: | case IDC_BASE + IDC_TOOLRESET: |
| if (!winui_en) { | if (!winui_en) { |
| SendMessage(hWndMain, WM_COMMAND, IDM_RESET, 0); | SendMessage(g_hWndMain, WM_COMMAND, IDM_RESET, 0); |
| SetForegroundWindow(hWndMain); | SetForegroundWindow(g_hWndMain); |
| } | } |
| break; | break; |
| case IDC_BASE + IDC_TOOLPOWER: | case IDC_BASE + IDC_TOOLPOWER: |
| if (!winui_en) { | if (!winui_en) { |
| SendMessage(hWndMain, WM_CLOSE, 0, 0L); | SendMessage(g_hWndMain, WM_CLOSE, 0, 0L); |
| } | } |
| break; | break; |
| case IDM_SKINSEL: | case IDM_TOOL_SKINSEL: |
| soundmng_disable(SNDPROC_TOOL); | soundmng_disable(SNDPROC_TOOL); |
| r = dlgs_selectfile(hWnd, &skinui, np2tool.skin, | r = dlgs_openfile(hWnd, &fpSkin, np2tool.skin, |
| sizeof(np2tool.skin), NULL); | NELEMENTS(np2tool.skin), NULL); |
| soundmng_enable(SNDPROC_TOOL); | soundmng_enable(SNDPROC_TOOL); |
| if (r) { | if (r) { |
| skinchange(hWnd); | skinchange(hWnd); |
| } | } |
| break; | break; |
| case IDM_SKINDEF: | case IDM_TOOL_SKINDEF: |
| np2tool.skin[0] = '\0'; | np2tool.skin[0] = '\0'; |
| skinchange(hWnd); | skinchange(hWnd); |
| break; | break; |
| case IDM_SKINMRU + 0: | case IDM_TOOL_SKINMRU + 0: |
| case IDM_SKINMRU + 1: | case IDM_TOOL_SKINMRU + 1: |
| case IDM_SKINMRU + 2: | case IDM_TOOL_SKINMRU + 2: |
| case IDM_SKINMRU + 3: | case IDM_TOOL_SKINMRU + 3: |
| file_cpyname(np2tool.skin, | file_cpyname(np2tool.skin, |
| np2tool.skinmru[LOWORD(wp) - IDM_SKINMRU], | np2tool.skinmru[LOWORD(wp) - IDM_TOOL_SKINMRU], |
| sizeof(np2tool.skin)); | NELEMENTS(np2tool.skin)); |
| skinchange(hWnd); | skinchange(hWnd); |
| break; | break; |
| case IDM_TOOLCLOSE: | case IDM_CLOSE: |
| SendMessage(hWnd, WM_CLOSE, 0, 0); | SendMessage(hWnd, WM_CLOSE, 0, 0); |
| break; | break; |
| default: | default: |
| if (!winui_en) { | if (!winui_en) { |
| return(SendMessage(hWndMain, msg, wp, lp)); | return(SendMessage(g_hWndMain, uMsg, wp, lp)); |
| } | } |
| break; | break; |
| } | } |
| Line 780 static LRESULT CALLBACK twproc(HWND hWnd | Line 876 static LRESULT CALLBACK twproc(HWND hWnd |
| case WM_KEYDOWN: // TABを押した時に復帰 | case WM_KEYDOWN: // TABを押した時に復帰 |
| if ((short)wp == VK_TAB) { | if ((short)wp == VK_TAB) { |
| idc = GetWindowLong(hWnd, GTWL_FOCUS); | idc = (UINT)GetWindowLongPtr(hWnd, GTWLP_FOCUS); |
| if (idc < IDC_MAXITEMS) { | if (idc < IDC_MAXITEMS) { |
| SetFocus(toolwin.sub[idc]); | SetFocus(toolwin.sub[idc]); |
| } | } |
| return(0); | return(0); |
| } | } |
| return(SendMessage(hWndMain, msg, wp, lp)); | return(SendMessage(g_hWndMain, uMsg, wp, lp)); |
| case WM_KEYUP: | case WM_KEYUP: |
| if ((short)wp == VK_TAB) { | if ((short)wp == VK_TAB) { |
| return(0); | return(0); |
| } | } |
| return(SendMessage(hWndMain, msg, wp, lp)); | return(SendMessage(g_hWndMain, uMsg, wp, lp)); |
| case WM_PAINT: | case WM_PAINT: |
| toolwinpaint(hWnd); | toolwinpaint(hWnd); |
| break; | break; |
| case WM_DRAWITEM: | case WM_DRAWITEM: |
| tooldrawbutton(hWnd, wp, (LPDRAWITEMSTRUCT)lp); | tooldrawbutton(hWnd, (UINT)wp, (LPDRAWITEMSTRUCT)lp); |
| break; | break; |
| case WM_ENTERMENULOOP: | case WM_ENTERMENULOOP: |
| Line 861 static LRESULT CALLBACK twproc(HWND hWnd | Line 957 static LRESULT CALLBACK twproc(HWND hWnd |
| case WM_LBUTTONDBLCLK: | case WM_LBUTTONDBLCLK: |
| np2tool.type ^= 1; | np2tool.type ^= 1; |
| wlex = np2_winlocexallwin(hWndMain); | wlex = np2_winlocexallwin(g_hWndMain); |
| winlocex_setholdwnd(wlex, hWnd); | |
| np2class_windowtype(hWnd, (np2tool.type & 1) << 1); | np2class_windowtype(hWnd, (np2tool.type & 1) << 1); |
| winlocex_move(wlex); | winlocex_move(wlex); |
| winlocex_destroy(wlex); | winlocex_destroy(wlex); |
| Line 869 static LRESULT CALLBACK twproc(HWND hWnd | Line 966 static LRESULT CALLBACK twproc(HWND hWnd |
| break; | break; |
| default: | default: |
| return(DefWindowProc(hWnd, msg, wp, lp)); | return(DefWindowProc(hWnd, uMsg, wp, lp)); |
| } | } |
| return(0); | return(0); |
| } | } |
| Line 881 BOOL toolwin_initapp(HINSTANCE hInstance | Line 978 BOOL toolwin_initapp(HINSTANCE hInstance |
| wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; | wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; |
| wc.lpfnWndProc = twproc; | wc.lpfnWndProc = twproc; |
| wc.cbClsExtra = 0; | wc.cbClsExtra = 0; |
| wc.cbWndExtra = GTWL_SIZE; | wc.cbWndExtra = GTWLP_SIZE; |
| wc.hInstance = hInstance; | wc.hInstance = hInstance; |
| wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON2)); | wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON2)); |
| wc.hCursor = LoadCursor(NULL, IDC_ARROW); | wc.hCursor = LoadCursor(NULL, IDC_ARROW); |
| Line 891 BOOL toolwin_initapp(HINSTANCE hInstance | Line 988 BOOL toolwin_initapp(HINSTANCE hInstance |
| return(RegisterClass(&wc)); | return(RegisterClass(&wc)); |
| } | } |
| void toolwin_create(void) { | void toolwin_create(HINSTANCE hInstance) { |
| HBITMAP hbmp; | HBITMAP hbmp; |
| BITMAP bmp; | BITMAP bmp; |
| TCHAR szCaption[128]; | |
| HWND hWnd; | HWND hWnd; |
| if (toolwin.hwnd) { | if (toolwin.hwnd) { |
| Line 907 void toolwin_create(void) { | Line 1005 void toolwin_create(void) { |
| } | } |
| GetObject(hbmp, sizeof(BITMAP), &bmp); | GetObject(hbmp, sizeof(BITMAP), &bmp); |
| toolwin.hbmp = hbmp; | toolwin.hbmp = hbmp; |
| hWnd = CreateWindow(np2toolclass, np2tooltitle, | |
| loadstringresource(LOWORD(IDS_CAPTION_TOOL), | |
| szCaption, NELEMENTS(szCaption)); | |
| hWnd = CreateWindow(np2toolclass, szCaption, | |
| WS_SYSMENU | WS_MINIMIZEBOX, | WS_SYSMENU | WS_MINIMIZEBOX, |
| np2tool.posx, np2tool.posy, | np2tool.posx, np2tool.posy, |
| bmp.bmWidth, bmp.bmHeight, | bmp.bmWidth, bmp.bmHeight, |
| NULL, NULL, hInst, NULL); | NULL, NULL, hInstance, NULL); |
| winloc_setclientsize(hWnd, bmp.bmWidth, bmp.bmHeight); | winloc_setclientsize(hWnd, bmp.bmWidth, bmp.bmHeight); |
| toolwin.hwnd = hWnd; | toolwin.hwnd = hWnd; |
| if (hWnd == NULL) { | if (hWnd == NULL) { |
| Line 919 void toolwin_create(void) { | Line 1020 void toolwin_create(void) { |
| } | } |
| UpdateWindow(hWnd); | UpdateWindow(hWnd); |
| ShowWindow(hWnd, SW_SHOWNOACTIVATE); | ShowWindow(hWnd, SW_SHOWNOACTIVATE); |
| SetForegroundWindow(hWndMain); | SetForegroundWindow(g_hWndMain); |
| return; | return; |
| twope_err2: | twope_err2: |
| Line 943 HWND toolwin_gethwnd(void) { | Line 1044 HWND toolwin_gethwnd(void) { |
| return(toolwin.hwnd); | return(toolwin.hwnd); |
| } | } |
| void toolwin_setfdd(BYTE drv, const char *name) { | void toolwin_setfdd(UINT8 drv, const OEMCHAR *name) { |
| TOOLFDD *fdd; | TOOLFDD *fdd; |
| char *q; | OEMCHAR *q; |
| char *p; | OEMCHAR *p; |
| UINT i; | UINT i; |
| HWND sub; | HWND sub; |
| Line 965 void toolwin_setfdd(BYTE drv, const char | Line 1066 void toolwin_setfdd(BYTE drv, const char |
| if (!file_cmpname(q, name)) { | if (!file_cmpname(q, name)) { |
| break; | break; |
| } | } |
| q += sizeof(fdd->name[0]); | q += NELEMENTS(fdd->name[0]); |
| } | } |
| p = q - sizeof(fdd->name[0]); | p = q - NELEMENTS(fdd->name[0]); |
| while(i > 0) { | while(i > 0) { |
| i--; | i--; |
| CopyMemory(q, p, sizeof(fdd->name[0])); | CopyMemory(q, p, sizeof(fdd->name[0])); |
| p -= sizeof(fdd->name[0]); | p -= NELEMENTS(fdd->name[0]); |
| q -= sizeof(fdd->name[0]); | q -= NELEMENTS(fdd->name[0]); |
| } | } |
| file_cpyname(fdd->name[0], name, sizeof(fdd->name[0])); | file_cpyname(fdd->name[0], name, NELEMENTS(fdd->name[0])); |
| } | } |
| sysmng_update(SYS_UPDATEOSCFG); | sysmng_update(SYS_UPDATEOSCFG); |
| if (toolwin.hwnd != NULL) { | if (toolwin.hwnd != NULL) { |
| sub = toolwin.sub[fddlist[drv]]; | sub = toolwin.sub[fddlist[drv]]; |
| if (sub) { | if (sub) { |
| remakefddlist(sub, fdd); | remakefddlist(sub, fdd); |
| SetForegroundWindow(hWndMain); | SetForegroundWindow(g_hWndMain); |
| } | } |
| } | } |
| } | } |
| static void setdiskacc(UINT num, BYTE count) { | static void setdiskacc(UINT num, UINT8 count) { |
| const DISKACC *acc; | const DISKACC *acc; |
| HWND sub; | HWND sub; |
| Line 994 const DISKACC *acc; | Line 1095 const DISKACC *acc; |
| if (toolwin.hwnd == NULL) { | if (toolwin.hwnd == NULL) { |
| return; | return; |
| } | } |
| if (num < (sizeof(diskacc)/sizeof(DISKACC))) { | if (num < NELEMENTS(diskacc)) { |
| acc = diskacc + num; | acc = diskacc + num; |
| sub = NULL; | sub = NULL; |
| if (*(acc->counter) == 0) { | if (*(acc->counter) == 0) { |
| Line 1007 const DISKACC *acc; | Line 1108 const DISKACC *acc; |
| } | } |
| } | } |
| void toolwin_fddaccess(BYTE drv) { | void toolwin_fddaccess(UINT8 drv) { |
| if (drv < 2) { | if (drv < 2) { |
| setdiskacc(drv, 20); | setdiskacc(drv, 20); |
| } | } |
| } | } |
| void toolwin_hddaccess(BYTE drv) { | void toolwin_hddaccess(UINT8 drv) { |
| setdiskacc(2, 10); | setdiskacc(2, 10); |
| } | } |
| void toolwin_draw(BYTE frame) { | void toolwin_draw(UINT8 frame) { |
| const DISKACC *acc; | const DISKACC *acc; |
| const DISKACC *accterm; | const DISKACC *accterm; |
| BYTE counter; | UINT8 counter; |
| HWND sub; | HWND sub; |
| if (toolwin.hwnd == NULL) { | if (toolwin.hwnd == NULL) { |
| Line 1033 const DISKACC *accterm; | Line 1134 const DISKACC *accterm; |
| frame = 1; | frame = 1; |
| } | } |
| acc = diskacc; | acc = diskacc; |
| accterm = acc + (sizeof(diskacc)/sizeof(DISKACC)); | accterm = acc + NELEMENTS(diskacc); |
| while(acc < accterm) { | while(acc < accterm) { |
| counter = *acc->counter; | counter = *acc->counter; |
| if (counter) { | if (counter) { |
| Line 1055 const DISKACC *accterm; | Line 1156 const DISKACC *accterm; |
| // ---- | // ---- |
| static const char ini_title[] = "NP2 tool"; | static const OEMCHAR ini_title[] = OEMTEXT("NP2 tool"); |
| static const INITBL iniitem[] = { | static const PFTBL iniitem[] = { |
| {"WindposX", INITYPE_SINT32, &np2tool.posx, 0}, | PFVAL("WindposX", PFTYPE_SINT32, &np2tool.posx), |
| {"WindposY", INITYPE_SINT32, &np2tool.posy, 0}, | PFVAL("WindposY", PFTYPE_SINT32, &np2tool.posy), |
| {"WindType", INITYPE_BOOL, &np2tool.type, 0}, | PFVAL("WindType", PFTYPE_BOOL, &np2tool.type), |
| {"SkinFile", INITYPE_STR, np2tool.skin, MAX_PATH}, | PFSTR("SkinFile", PFTYPE_STR, np2tool.skin), |
| {"SkinMRU0", INITYPE_STR, np2tool.skinmru[0], MAX_PATH}, | PFSTR("SkinMRU0", PFTYPE_STR, np2tool.skinmru[0]), |
| {"SkinMRU1", INITYPE_STR, np2tool.skinmru[1], MAX_PATH}, | PFSTR("SkinMRU1", PFTYPE_STR, np2tool.skinmru[1]), |
| {"SkinMRU2", INITYPE_STR, np2tool.skinmru[2], MAX_PATH}, | PFSTR("SkinMRU2", PFTYPE_STR, np2tool.skinmru[2]), |
| {"SkinMRU3", INITYPE_STR, np2tool.skinmru[3], MAX_PATH}, | PFSTR("SkinMRU3", PFTYPE_STR, np2tool.skinmru[3]), |
| {"FD1NAME0", INITYPE_STR, np2tool.fdd[0].name[0], MAX_PATH}, | PFSTR("FD1NAME0", PFTYPE_STR, np2tool.fdd[0].name[0]), |
| {"FD1NAME1", INITYPE_STR, np2tool.fdd[0].name[1], MAX_PATH}, | PFSTR("FD1NAME1", PFTYPE_STR, np2tool.fdd[0].name[1]), |
| {"FD1NAME2", INITYPE_STR, np2tool.fdd[0].name[2], MAX_PATH}, | PFSTR("FD1NAME2", PFTYPE_STR, np2tool.fdd[0].name[2]), |
| {"FD1NAME3", INITYPE_STR, np2tool.fdd[0].name[3], MAX_PATH}, | PFSTR("FD1NAME3", PFTYPE_STR, np2tool.fdd[0].name[3]), |
| {"FD1NAME4", INITYPE_STR, np2tool.fdd[0].name[4], MAX_PATH}, | PFSTR("FD1NAME4", PFTYPE_STR, np2tool.fdd[0].name[4]), |
| {"FD1NAME5", INITYPE_STR, np2tool.fdd[0].name[5], MAX_PATH}, | PFSTR("FD1NAME5", PFTYPE_STR, np2tool.fdd[0].name[5]), |
| {"FD1NAME6", INITYPE_STR, np2tool.fdd[0].name[6], MAX_PATH}, | PFSTR("FD1NAME6", PFTYPE_STR, np2tool.fdd[0].name[6]), |
| {"FD1NAME7", INITYPE_STR, np2tool.fdd[0].name[7], MAX_PATH}, | PFSTR("FD1NAME7", PFTYPE_STR, np2tool.fdd[0].name[7]), |
| {"FD2NAME0", INITYPE_STR, np2tool.fdd[1].name[0], MAX_PATH}, | PFSTR("FD2NAME0", PFTYPE_STR, np2tool.fdd[1].name[0]), |
| {"FD2NAME1", INITYPE_STR, np2tool.fdd[1].name[1], MAX_PATH}, | PFSTR("FD2NAME1", PFTYPE_STR, np2tool.fdd[1].name[1]), |
| {"FD2NAME2", INITYPE_STR, np2tool.fdd[1].name[2], MAX_PATH}, | PFSTR("FD2NAME2", PFTYPE_STR, np2tool.fdd[1].name[2]), |
| {"FD2NAME3", INITYPE_STR, np2tool.fdd[1].name[3], MAX_PATH}, | PFSTR("FD2NAME3", PFTYPE_STR, np2tool.fdd[1].name[3]), |
| {"FD2NAME4", INITYPE_STR, np2tool.fdd[1].name[4], MAX_PATH}, | PFSTR("FD2NAME4", PFTYPE_STR, np2tool.fdd[1].name[4]), |
| {"FD2NAME5", INITYPE_STR, np2tool.fdd[1].name[5], MAX_PATH}, | PFSTR("FD2NAME5", PFTYPE_STR, np2tool.fdd[1].name[5]), |
| {"FD2NAME6", INITYPE_STR, np2tool.fdd[1].name[6], MAX_PATH}, | PFSTR("FD2NAME6", PFTYPE_STR, np2tool.fdd[1].name[6]), |
| {"FD2NAME7", INITYPE_STR, np2tool.fdd[1].name[7], MAX_PATH}}; | PFSTR("FD2NAME7", PFTYPE_STR, np2tool.fdd[1].name[7])}; |
| void toolwin_readini(void) { | void toolwin_readini(void) { |
| char path[MAX_PATH]; | OEMCHAR path[MAX_PATH]; |
| ZeroMemory(&np2tool, sizeof(np2tool)); | ZeroMemory(&np2tool, sizeof(np2tool)); |
| np2tool.posx = CW_USEDEFAULT; | np2tool.posx = CW_USEDEFAULT; |
| np2tool.posy = CW_USEDEFAULT; | np2tool.posy = CW_USEDEFAULT; |
| np2tool.type = 1; | np2tool.type = 1; |
| initgetfile(path, sizeof(path)); | initgetfile(path, NELEMENTS(path)); |
| ini_read(path, ini_title, iniitem, sizeof(iniitem)/sizeof(INITBL)); | ini_read(path, ini_title, iniitem, NELEMENTS(iniitem)); |
| } | } |
| void toolwin_writeini(void) { | void toolwin_writeini(void) { |
| char path[MAX_PATH]; | OEMCHAR path[MAX_PATH]; |
| initgetfile(path, sizeof(path)); | initgetfile(path, NELEMENTS(path)); |
| ini_write(path, ini_title, iniitem, sizeof(iniitem)/sizeof(INITBL)); | ini_write(path, ini_title, iniitem, NELEMENTS(iniitem)); |
| } | } |