--- np2/win9x/dialog/dialogs.cpp 2005/02/07 15:39:28 1.5 +++ np2/win9x/dialog/dialogs.cpp 2005/03/20 23:48:03 1.9 @@ -1,27 +1,34 @@ #include "compiler.h" #include "strres.h" #include "bmpdata.h" +#include "oemtext.h" #include "dosio.h" #include "commng.h" #include "dialogs.h" +#if defined(MT32SOUND_DLL) +#include "mt32snd.h" +#endif -static const char str_nc[] = "N/C"; +const TCHAR str_nc[] = _T("N/C"); -const char str_int0[] = "INT0"; -const char str_int1[] = "INT1"; -const char str_int2[] = "INT2"; -const char str_int4[] = "INT4"; -const char str_int5[] = "INT5"; -const char str_int6[] = "INT6"; +const TCHAR str_int0[] = _T("INT0"); +const TCHAR str_int1[] = _T("INT1"); +const TCHAR str_int2[] = _T("INT2"); +const TCHAR str_int4[] = _T("INT4"); +const TCHAR str_int5[] = _T("INT5"); +const TCHAR str_int6[] = _T("INT6"); // ---- file select BOOL dlgs_selectfile(HWND hWnd, const FILESEL *item, - char *path, UINT size, int *ro) { + OEMCHAR *path, UINT size, int *ro) { OPENFILENAME ofn; +#if defined(OSLANG_UTF8) + TCHAR _path[MAX_PATH]; +#endif if ((item == NULL) || (path == NULL) || (size == 0)) { return(FALSE); @@ -31,14 +38,23 @@ BOOL dlgs_selectfile(HWND hWnd, const FI ofn.hwndOwner = hWnd; ofn.lpstrFilter = item->filter; ofn.nFilterIndex = item->defindex; +#if defined(OSLANG_UTF8) + oemtotchar(_path, NELEMENTS(_path), path, -1); + ofn.lpstrFile = _path; + ofn.nMaxFile = NELEMENTS(_path); +#else ofn.lpstrFile = path; ofn.nMaxFile = size; +#endif ofn.Flags = OFN_FILEMUSTEXIST; ofn.lpstrDefExt = item->ext; ofn.lpstrTitle = item->title; if (!GetOpenFileName(&ofn)) { return(FALSE); } +#if defined(OSLANG_UTF8) + tchartooem(path, NELEMENTS(path), _path, -1); +#endif if (ro) { *ro = ofn.Flags & OFN_READONLY; } @@ -46,9 +62,12 @@ BOOL dlgs_selectfile(HWND hWnd, const FI } BOOL dlgs_selectwritefile(HWND hWnd, const FILESEL *item, - char *path, UINT size) { + OEMCHAR *path, UINT size) { OPENFILENAME ofn; +#if defined(OSLANG_UTF8) + TCHAR _path[MAX_PATH]; +#endif if ((item == NULL) || (path == NULL) || (size == 0)) { return(FALSE); @@ -58,40 +77,49 @@ BOOL dlgs_selectwritefile(HWND hWnd, con ofn.hwndOwner = hWnd; ofn.lpstrFilter = item->filter; ofn.nFilterIndex = item->defindex; +#if defined(OSLANG_UTF8) + oemtotchar(_path, NELEMENTS(_path), path, -1); + ofn.lpstrFile = _path; + ofn.nMaxFile = NELEMENTS(_path); +#else ofn.lpstrFile = path; ofn.nMaxFile = size; +#endif ofn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY; ofn.lpstrDefExt = item->ext; ofn.lpstrTitle = item->title; if (!GetSaveFileName(&ofn)) { return(FALSE); } +#if defined(OSLANG_UTF8) + tchartooem(path, NELEMENTS(path), _path, -1); +#endif return(TRUE); } BOOL dlgs_selectwritenum(HWND hWnd, const FILESEL *item, - char *path, UINT size) { + OEMCHAR *path, UINT size) { - char *file; - char *p; - char *q; + OEMCHAR *file; + OEMCHAR *p; + OEMCHAR *q; UINT i; BOOL r; if ((item == NULL) || (path == NULL) || (size == 0)) { return(FALSE); } - file = (char *)_MALLOC(size + 16, path); + file = (OEMCHAR *)_MALLOC((size + 16) * sizeof(OEMCHAR), path); if (file == NULL) { return(FALSE); } p = file_getname(path); milstr_ncpy(file, path, size); file_cutname(file); - q = file + strlen(file); + q = file + OEMSTRLEN(file); for (i=0; i<10000; i++) { - SPRINTF(q, p, i); + OEMSPRINTF(q, p, i); if (file_attr(file) == (short)-1) { break; } @@ -107,20 +135,20 @@ BOOL dlgs_selectwritenum(HWND hWnd, cons // ---- mimpi def file -static const char mimpi_title[] = "Open MIMPI define file"; -static const char mimpi_ext[] = "def"; -static const char mimpi_filter[] = "MIMPI define file(*.def)\0*.def\0"; +static const TCHAR mimpi_title[] = _T("Open MIMPI define file"); +static const TCHAR mimpi_ext[] = _T("def"); +static const TCHAR mimpi_filter[] = _T("MIMPI define file(*.def)\0*.def\0"); static const FILESEL mimpi = {mimpi_title, mimpi_ext, mimpi_filter, 1}; void dlgs_browsemimpidef(HWND hWnd, UINT16 res) { - HWND subwnd; - char path[MAX_PATH]; -const char *p; + HWND subwnd; + OEMCHAR path[MAX_PATH]; +const OEMCHAR *p; subwnd = GetDlgItem(hWnd, res); - GetWindowText(subwnd, path, sizeof(path)); - if (dlgs_selectfile(hWnd, &mimpi, path, sizeof(path), NULL)) { + GetWindowText(subwnd, path, NELEMENTS(path)); + if (dlgs_selectfile(hWnd, &mimpi, path, NELEMENTS(path), NULL)) { p = path; } else { @@ -132,7 +160,7 @@ const char *p; // ---- list -void dlgs_setliststr(HWND hWnd, UINT16 res, const char **item, UINT items) { +void dlgs_setliststr(HWND hWnd, UINT16 res, const TCHAR **item, UINT items) { HWND wnd; UINT i; @@ -147,11 +175,11 @@ void dlgs_setlistuint32(HWND hWnd, UINT1 HWND wnd; UINT i; - char str[16]; + OEMCHAR str[16]; wnd = GetDlgItem(hWnd, res); for (i=0; i