--- np2/win9x/toolwin.cpp 2003/11/02 17:03:24 1.12 +++ np2/win9x/toolwin.cpp 2005/02/07 14:46:14 1.16 @@ -35,10 +35,10 @@ enum { IDC_BASE = 3000, - IDC_SKINSEL = 3100, - IDC_SKINDEF = 3101, - IDC_SKINMRU = 3102, - IDC_TOOLCLOSE = IDC_SKINMRU + SKINMRU_MAX + IDM_SKINSEL = 3100, + IDM_SKINDEF = 3101, + IDM_SKINMRU = 3102, + IDM_TOOLCLOSE = IDM_SKINMRU + SKINMRU_MAX }; enum { @@ -70,9 +70,9 @@ typedef struct { HWND hwnd; WINLOCEX wlex; HBITMAP hbmp; - BYTE fddaccess[2]; - BYTE hddaccess; - BYTE _padding; + UINT8 fddaccess[2]; + UINT8 hddaccess; + UINT8 _padding; int winflg; int wingx; int wingy; @@ -103,10 +103,10 @@ static TOOLWIN toolwin; typedef struct { WORD idc; - BYTE *counter; + UINT8 *counter; } DISKACC; -static const BYTE fddlist[FDDLIST_DRV] = { +static const UINT8 fddlist[FDDLIST_DRV] = { IDC_TOOLFDD1LIST, IDC_TOOLFDD2LIST}; static const DISKACC diskacc[3] = { @@ -129,7 +129,7 @@ static HBITMAP skinload(const char *path toolskin.color1 = 0x600000; toolskin.color2 = 0xff0000; if (path) { - ini_read(path, skintitle, skinini1, sizeof(skinini1)/sizeof(INITBL)); + ini_read(path, skintitle, skinini1, NELEMENTS(skinini1)); } if (toolskin.main[0]) { ZeroMemory(subitem, sizeof(defsubitem)); @@ -142,7 +142,7 @@ static HBITMAP skinload(const char *path CopyMemory(subitem, defsubitem, sizeof(defsubitem)); } if (path) { - ini_read(path, skintitle, skinini2, sizeof(skinini2)/sizeof(INITBL)); + ini_read(path, skintitle, skinini2, NELEMENTS(skinini2)); } if (toolskin.main[0]) { milstr_ncpy(fname, path, sizeof(fname)); @@ -180,17 +180,12 @@ static void calctextsize(char *path, int file_cutname(path); file_cutseparator(path); file_cutname(path); + file_cutseparator(path); l = strlen(path); - if (l > 1) { - l -= 1; - if (milstr_kanji2nd(p, l - 1)) { - l--; - } - } - else { - l = 0; + work[0] = '\0'; + if (l) { + milstr_ncpy(work, str_browse, sizeof(work)); } - milstr_ncpy(work, str_browse, sizeof(work)); milstr_ncat(work, p + l, sizeof(work)); GetTextExtentPoint32(hdc, work, strlen(work), &tail); pos = 0; @@ -305,7 +300,7 @@ static void remakefddlist(HWND hwnd, TOO setlist(hwnd, fdd, sel); } -static void accdraw(HWND hWnd, BYTE count) { +static void accdraw(HWND hWnd, UINT8 count) { HDC hdc; PAINTSTRUCT ps; @@ -557,12 +552,12 @@ const char *base; const char *file[SKINMRU_MAX]; ret = CreatePopupMenu(); - AppendMenu(ret, MF_STRING, IDC_SKINSEL, str_skinsel); + AppendMenu(ret, MF_STRING, IDM_SKINSEL, str_skinsel); AppendMenu(ret, MF_SEPARATOR, 0, NULL); base = np2tool.skin; flag = (base[0] == '\0')?MF_CHECKED:0; - AppendMenu(ret, MF_STRING + flag, IDC_SKINDEF, str_skindef); + AppendMenu(ret, MF_STRING + flag, IDM_SKINDEF, str_skindef); for (cnt=0; cntcounter) == 0) { @@ -980,23 +1004,23 @@ const DISKACC *acc; } } -void toolwin_fddaccess(BYTE drv) { +void toolwin_fddaccess(UINT8 drv) { if (drv < 2) { setdiskacc(drv, 20); } } -void toolwin_hddaccess(BYTE drv) { +void toolwin_hddaccess(UINT8 drv) { setdiskacc(2, 10); } -void toolwin_draw(BYTE frame) { +void toolwin_draw(UINT8 frame) { const DISKACC *acc; const DISKACC *accterm; - BYTE counter; + UINT8 counter; HWND sub; if (toolwin.hwnd == NULL) { @@ -1006,7 +1030,7 @@ const DISKACC *accterm; frame = 1; } acc = diskacc; - accterm = acc + (sizeof(diskacc)/sizeof(DISKACC)); + accterm = acc + NELEMENTS(diskacc); while(acc < accterm) { counter = *acc->counter; if (counter) { @@ -1065,7 +1089,7 @@ void toolwin_readini(void) { np2tool.posy = CW_USEDEFAULT; np2tool.type = 1; initgetfile(path, sizeof(path)); - ini_read(path, ini_title, iniitem, sizeof(iniitem)/sizeof(INITBL)); + ini_read(path, ini_title, iniitem, NELEMENTS(iniitem)); } void toolwin_writeini(void) { @@ -1073,6 +1097,6 @@ void toolwin_writeini(void) { char path[MAX_PATH]; initgetfile(path, sizeof(path)); - ini_write(path, ini_title, iniitem, sizeof(iniitem)/sizeof(INITBL)); + ini_write(path, ini_title, iniitem, NELEMENTS(iniitem)); }