--- np2/win9x/dialog/d_disk.cpp 2005/02/09 20:11:36 1.12 +++ np2/win9x/dialog/d_disk.cpp 2007/11/11 07:11:28 1.19 @@ -2,6 +2,7 @@ #include "strres.h" #include "resource.h" #include "np2.h" +#include "oemtext.h" #include "dosio.h" #include "sysmng.h" #include "toolwin.h" @@ -12,32 +13,69 @@ #include "fddfile.h" #include "newdisk.h" - -static const OEMCHAR fddui_title[] = OEMTEXT("Select floppy image"); -static const OEMCHAR fddui_filter[] = OEMTEXT("D88 image files (*.D88;*.D98)\0*.d88;*.88d;*.d98;*.98d\0Floppy disk images (*.XDF;*.HDM;*.DUP;*.2HD)\0*.xdf;*.hdm;*.dup;*.2hd;*.tfd\0All supported Files\0*.d88;*.88d;*.d98;*.98d;*.fdi;*.xdf;*.hdm;*.dup;*.2hd;*.tfd\0All files (*.*)\0*.*\0"); -static const FILESEL fddui = {fddui_title, str_d88, fddui_filter, 3}; +static const FSPARAM fpFDD = +{ + MAKEINTRESOURCE(IDS_FDDTITLE), + MAKEINTRESOURCE(IDS_FDDEXT), + MAKEINTRESOURCE(IDS_FDDFILTER), + 3 +}; #if defined(SUPPORT_SASI) -static const OEMCHAR sasiui_title[] = OEMTEXT("Select SASI/IDE HDD image"); -#else -static const OEMCHAR sasiui_title[] = OEMTEXT("Select HDD image"); -#endif -static const OEMCHAR sasiui_filter[] = OEMTEXT("Anex86 harddisk image files (*.HDI)\0*.hdi\0T98 harddisk image files (*.THD)\0*.thd\0T98-Next harddisk image files (*.NHD)\0*.nhd\0All supported Files\0*.thd;*.nhd;*.hdi\0"); -static const FILESEL sasiui = {sasiui_title, str_thd, sasiui_filter, 4}; +static const FSPARAM fpSASI = +{ + MAKEINTRESOURCE(IDS_SASITITLE), + MAKEINTRESOURCE(IDS_HDDEXT), + MAKEINTRESOURCE(IDS_HDDFILTER), + 4 +}; +#else // defined(SUPPORT_SASI) +static const FSPARAM fpSASI = +{ + MAKEINTRESOURCE(IDS_HDDTITLE), + MAKEINTRESOURCE(IDS_HDDEXT), + MAKEINTRESOURCE(IDS_HDDFILTER), + 4 +}; +#endif // defined(SUPPORT_SASI) + +#if defined(SUPPORT_IDEIO) +static const FSPARAM fpISO = +{ + MAKEINTRESOURCE(IDS_ISOTITLE), + MAKEINTRESOURCE(IDS_ISOEXT), + MAKEINTRESOURCE(IDS_ISOFILTER), + 3 +}; +#endif // defined(SUPPORT_IDEIO) #if defined(SUPPORT_SCSI) -static const OEMCHAR scsiui_title[] = OEMTEXT("Select SCSI HDD image"); -static const OEMCHAR scsiui_filter[] = OEMTEXT("Virtual98 harddisk image files (*.HDD)\0*.hdd\0"); -static const FILESEL scsiui = {scsiui_title, str_hdd, scsiui_filter, 1}; -#endif +static const FSPARAM fpSCSI = +{ + MAKEINTRESOURCE(IDS_SCSITITLE), + MAKEINTRESOURCE(IDS_SCSIEXT), + MAKEINTRESOURCE(IDS_SCSIFILTER), + 1 +}; +#endif // defined(SUPPORT_SCSI) -static const OEMCHAR newdisk_title[] = OEMTEXT("Create disk image"); #if defined(SUPPORT_SCSI) -static const OEMCHAR newdisk_filter[] = OEMTEXT("D88 image files (*.D88;*.88D)\0*.d88;*.88d;*.d98;*.98d\0Anex86 harddisk image files (*.HDI)\0*.hdi\0T98 harddisk image files (*.THD)\0*.thd\0T98-Next harddisk image files (*.NHD)\0*.nhd\0Virtual98 harddisk image files (*.HDD)\0*.hdd\0"); -#else -static const OEMCHAR newdisk_filter[] = OEMTEXT("D88 image files (*.D88;*.88D)\0*.d88;*.88d;*.d98;*.98d\0Anex86 harddisk image files (*.HDI)\0*.hdi\0T98 harddisk image files (*.THD)\0*.thd\0T98-Next harddisk image files (*.NHD)\0*.nhd\0"); -#endif -static const FILESEL newdiskui = {newdisk_title, str_d88, newdisk_filter, 1}; +static const FSPARAM fpNewDisk = +{ + MAKEINTRESOURCE(IDS_NEWDISKTITLE), + MAKEINTRESOURCE(IDS_NEWDISKEXT), + MAKEINTRESOURCE(IDS_NEWDISKFILTER), + 1 +}; +#else // defined(SUPPORT_SCSI) +static const FSPARAM fpNewDisk = +{ + MAKEINTRESOURCE(IDS_NEWDISKTITLE), + MAKEINTRESOURCE(IDS_NEWDISKEXT), + MAKEINTRESOURCE(IDS_NEWDISKFILTER2), + 1 +}; +#endif // defined(SUPPORT_SCSI) // ---- @@ -54,7 +92,8 @@ const OEMCHAR *p; p = fddfolder; } file_cpyname(path, p, NELEMENTS(path)); - if (dlgs_selectfile(hWnd, &fddui, path, NELEMENTS(path), &readonly)) { + if (dlgs_openfile(hWnd, &fpFDD, path, NELEMENTS(path), &readonly)) + { file_cpyname(fddfolder, path, NELEMENTS(fddfolder)); sysmng_update(SYS_UPDATEOSCFG); diskdrv_setfdd(drv, path, readonly); @@ -67,34 +106,45 @@ void dialog_changehdd(HWND hWnd, REG8 dr UINT num; const OEMCHAR *p; -const FILESEL *hddui; + PCFSPARAM pfp; OEMCHAR path[MAX_PATH]; + p = diskdrv_getsxsi(drv); num = drv & 0x0f; - p = NULL; - hddui = NULL; - if (!(drv & 0x20)) { // SASI/IDE - if (num < 2) { - p = np2cfg.sasihdd[num]; - hddui = &sasiui; + pfp = NULL; + if (!(drv & 0x20)) // SASI/IDE + { + if (num < 2) + { + pfp = &fpSASI; } +#if defined(SUPPORT_IDEIO) + else if (num == 2) + { + pfp = &fpISO; + } +#endif } #if defined(SUPPORT_SCSI) - else { // SCSI - if (num < 4) { - p = np2cfg.scsihdd[num]; - hddui = &scsiui; + else // SCSI + { + if (num < 4) + { + pfp = &fpSCSI; } } #endif - if (hddui == NULL) { + if (pfp == NULL) + { return; } - if (p[0] == '\0') { + if ((p == NULL) || (p[0] == '\0')) + { p = hddfolder; } file_cpyname(path, p, NELEMENTS(path)); - if (dlgs_selectfile(hWnd, hddui, path, NELEMENTS(path), NULL)) { + if (dlgs_openfile(hWnd, pfp, path, NELEMENTS(path), NULL)) + { file_cpyname(hddfolder, path, NELEMENTS(hddfolder)); sysmng_update(SYS_UPDATEOSCFG); diskdrv_sethdd(drv, path); @@ -122,12 +172,12 @@ static LRESULT CALLBACK NewHddDlgProc(HW WPARAM wp, LPARAM lp) { UINT val; - OEMCHAR work[32]; + TCHAR work[32]; switch (msg) { case WM_INITDIALOG: SETLISTUINT32(hWnd, IDC_HDDSIZE, hddsizetbl); - OEMSPRINTF(work, OEMTEXT("(%d-%dMB)"), hddminsize, hddmaxsize); + wsprintf(work, _T("(%d-%dMB)"), hddminsize, hddmaxsize); SetWindowText(GetDlgItem(hWnd, IDC_HDDLIMIT), work); SetFocus(GetDlgItem(hWnd, IDC_HDDSIZE)); return(FALSE); @@ -137,7 +187,7 @@ static LRESULT CALLBACK NewHddDlgProc(HW case IDOK: GetWindowText(GetDlgItem(hWnd, IDC_HDDSIZE), work, NELEMENTS(work)); - val = (UINT)milstr_solveINT(work); + val = (UINT)miltchar_solveINT(work); if (val < hddminsize) { val = hddminsize; } @@ -215,6 +265,9 @@ static LRESULT CALLBACK NewdiskDlgProc(H WPARAM wp, LPARAM lp) { UINT16 res; +#if defined(OSLANG_UTF8) + TCHAR buf[17]; +#endif switch (msg) { case WM_INITDIALOG: @@ -238,11 +291,17 @@ static LRESULT CALLBACK NewdiskDlgProc(H case WM_COMMAND: switch(LOWORD(wp)) { case IDOK: +#if defined(OSLANG_UTF8) + GetWindowText(GetDlgItem(hWnd, IDC_DISKLABEL), + buf, NELEMENTS(buf)); + tchartooem(disklabel, NELEMENTS(disklabel), buf, -1); +#else GetWindowText(GetDlgItem(hWnd, IDC_DISKLABEL), disklabel, NELEMENTS(disklabel)); if (milstr_kanji1st(disklabel, NELEMENTS(disklabel) - 1)) { disklabel[NELEMENTS(disklabel) - 1] = '\0'; } +#endif if (GetDlgItemCheck(hWnd, IDC_MAKE2DD)) { makefdtype = (DISKTYPE_2DD << 4); } @@ -284,10 +343,11 @@ const OEMCHAR *ext; file_cutname(path); file_catname(path, str_newdisk, NELEMENTS(path)); - if (!dlgs_selectwritefile(hWnd, &newdiskui, path, NELEMENTS(path))) { + if (!dlgs_createfile(hWnd, &fpNewDisk, path, NELEMENTS(path))) + { return; } - hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); + hinst = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE); ext = file_getext(path); if (!file_cmpname(ext, str_thd)) { hddsize = 0;