| version 1.7, 2005/03/02 04:28:09 | version 1.10, 2007/07/20 14:39:12 | 
| Line 1 | Line 1 | 
 | #include        "compiler.h" | #include        "compiler.h" | 
 | #include        "strres.h" | #include        "strres.h" | 
 | #include        "bmpdata.h" | #include        "bmpdata.h" | 
 |  | #include        "oemtext.h" | 
 | #include        "dosio.h" | #include        "dosio.h" | 
 | #include        "commng.h" | #include        "commng.h" | 
 | #include        "dialogs.h" | #include        "dialogs.h" | 
| Line 8 | Line 9 | 
 | #include        "mt32snd.h" | #include        "mt32snd.h" | 
 | #endif | #endif | 
 |  |  | 
 |  | extern HINSTANCE hInst; | 
 |  |  | 
 | const OEMCHAR str_nc[] = OEMTEXT("N/C"); |  | 
 |  |  | 
| const OEMCHAR str_int0[] = OEMTEXT("INT0"); | const TCHAR str_nc[] = _T("N/C"); | 
| const OEMCHAR str_int1[] = OEMTEXT("INT1"); |  | 
| const OEMCHAR str_int2[] = OEMTEXT("INT2"); | const TCHAR str_int0[] = _T("INT0"); | 
| const OEMCHAR str_int4[] = OEMTEXT("INT4"); | const TCHAR str_int1[] = _T("INT1"); | 
| const OEMCHAR str_int5[] = OEMTEXT("INT5"); | const TCHAR str_int2[] = _T("INT2"); | 
| const OEMCHAR str_int6[] = OEMTEXT("INT6"); | const TCHAR str_int4[] = _T("INT4"); | 
|  | const TCHAR str_int5[] = _T("INT5"); | 
|  | const TCHAR str_int6[] = _T("INT6"); | 
 |  |  | 
 |  |  | 
 | // ---- file select | // ---- file select | 
| Line 24  const OEMCHAR str_int6[] = OEMTEXT("INT6 | Line 27  const OEMCHAR str_int6[] = OEMTEXT("INT6 | 
 | BOOL dlgs_selectfile(HWND hWnd, const FILESEL *item, | BOOL dlgs_selectfile(HWND hWnd, const FILESEL *item, | 
 | OEMCHAR *path, UINT size, int *ro) { | OEMCHAR *path, UINT size, int *ro) { | 
 |  |  | 
 |  | TCHAR                   *pszTitle; | 
 | OPENFILENAME    ofn; | OPENFILENAME    ofn; | 
 |  | #if defined(OSLANG_UTF8) | 
 |  | TCHAR                   _path[MAX_PATH]; | 
 |  | #endif | 
 |  | BOOL                    bResult; | 
 |  |  | 
 | if ((item == NULL) || (path == NULL) || (size == 0)) { | if ((item == NULL) || (path == NULL) || (size == 0)) { | 
 | return(FALSE); | return(FALSE); | 
 | } | } | 
 |  | pszTitle = lockstringresource(hInst, item->title); | 
 |  |  | 
 | ZeroMemory(&ofn, sizeof(OPENFILENAME)); | ZeroMemory(&ofn, sizeof(OPENFILENAME)); | 
 | ofn.lStructSize = sizeof(OPENFILENAME); | ofn.lStructSize = sizeof(OPENFILENAME); | 
 | ofn.hwndOwner = hWnd; | ofn.hwndOwner = hWnd; | 
 | ofn.lpstrFilter = item->filter; | ofn.lpstrFilter = item->filter; | 
 | ofn.nFilterIndex = item->defindex; | 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.lpstrFile = path; | 
 | ofn.nMaxFile = size; | ofn.nMaxFile = size; | 
 |  | #endif | 
 | ofn.Flags = OFN_FILEMUSTEXIST; | ofn.Flags = OFN_FILEMUSTEXIST; | 
 | ofn.lpstrDefExt = item->ext; | ofn.lpstrDefExt = item->ext; | 
| ofn.lpstrTitle = item->title; | ofn.lpstrTitle = pszTitle; | 
| if (!GetOpenFileName(&ofn)) { |  | 
| return(FALSE); | bResult = GetOpenFileName(&ofn); | 
| } | unlockstringresource(pszTitle); | 
| if (ro) { |  | 
| *ro = ofn.Flags & OFN_READONLY; | if (bResult) { | 
|  | #if defined(OSLANG_UTF8) | 
|  | tchartooem(path, NELEMENTS(path), _path, -1); | 
|  | #endif | 
|  | if (ro) { | 
|  | *ro = ofn.Flags & OFN_READONLY; | 
|  | } | 
 | } | } | 
| return(TRUE); | return(bResult); | 
 | } | } | 
 |  |  | 
 | BOOL dlgs_selectwritefile(HWND hWnd, const FILESEL *item, | BOOL dlgs_selectwritefile(HWND hWnd, const FILESEL *item, | 
 | OEMCHAR *path, UINT size) { | OEMCHAR *path, UINT size) { | 
 |  |  | 
 | OPENFILENAME    ofn; | OPENFILENAME    ofn; | 
 |  | TCHAR                   *pszTitle; | 
 |  | #if defined(OSLANG_UTF8) | 
 |  | TCHAR                   _path[MAX_PATH]; | 
 |  | #endif | 
 |  | BOOL                    bResult; | 
 |  |  | 
 | if ((item == NULL) || (path == NULL) || (size == 0)) { | if ((item == NULL) || (path == NULL) || (size == 0)) { | 
 | return(FALSE); | return(FALSE); | 
 | } | } | 
 |  |  | 
 |  | pszTitle = lockstringresource(hInst, item->title); | 
 |  |  | 
 | ZeroMemory(&ofn, sizeof(OPENFILENAME)); | ZeroMemory(&ofn, sizeof(OPENFILENAME)); | 
 | ofn.lStructSize = sizeof(OPENFILENAME); | ofn.lStructSize = sizeof(OPENFILENAME); | 
 | ofn.hwndOwner = hWnd; | ofn.hwndOwner = hWnd; | 
 | ofn.lpstrFilter = item->filter; | ofn.lpstrFilter = item->filter; | 
 | ofn.nFilterIndex = item->defindex; | 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.lpstrFile = path; | 
 | ofn.nMaxFile = size; | ofn.nMaxFile = size; | 
 |  | #endif | 
 | ofn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY; | ofn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY; | 
 | ofn.lpstrDefExt = item->ext; | ofn.lpstrDefExt = item->ext; | 
| ofn.lpstrTitle = item->title; | ofn.lpstrTitle = pszTitle; | 
| if (!GetSaveFileName(&ofn)) { |  | 
| return(FALSE); | bResult = GetSaveFileName(&ofn); | 
|  |  | 
|  | unlockstringresource(pszTitle); | 
|  |  | 
|  | #if defined(OSLANG_UTF8) | 
|  | if (bResult) { | 
|  | tchartooem(path, NELEMENTS(path), _path, -1); | 
 | } | } | 
| return(TRUE); | #endif | 
|  | return(bResult); | 
 | } | } | 
 |  |  | 
 | BOOL dlgs_selectwritenum(HWND hWnd, const FILESEL *item, | BOOL dlgs_selectwritenum(HWND hWnd, const FILESEL *item, | 
| Line 110  BOOL dlgs_selectwritenum(HWND hWnd, cons | Line 153  BOOL dlgs_selectwritenum(HWND hWnd, cons | 
 |  |  | 
 | // ---- mimpi def file | // ---- mimpi def file | 
 |  |  | 
| static const OEMCHAR mimpi_title[] = OEMTEXT("Open MIMPI define file"); | static const TCHAR mimpi_title[] = _T("Open MIMPI define file"); | 
| static const OEMCHAR mimpi_ext[] = OEMTEXT("def"); | static const TCHAR mimpi_ext[] = _T("def"); | 
| static const OEMCHAR mimpi_filter[] = OEMTEXT("MIMPI define file(*.def)\0*.def\0"); | static const TCHAR mimpi_filter[] = _T("MIMPI define file(*.def)\0*.def\0"); | 
 | static const FILESEL mimpi = {mimpi_title, mimpi_ext, mimpi_filter, 1}; | static const FILESEL mimpi = {mimpi_title, mimpi_ext, mimpi_filter, 1}; | 
 |  |  | 
 | void dlgs_browsemimpidef(HWND hWnd, UINT16 res) { | void dlgs_browsemimpidef(HWND hWnd, UINT16 res) { | 
| Line 135  const OEMCHAR *p; | Line 178  const OEMCHAR *p; | 
 |  |  | 
 | // ---- list | // ---- list | 
 |  |  | 
| void dlgs_setliststr(HWND hWnd, UINT16 res, const OEMCHAR **item, UINT items) { | void dlgs_setliststr(HWND hWnd, UINT16 res, const TCHAR **item, UINT items) { | 
 |  |  | 
 | HWND    wnd; | HWND    wnd; | 
 | UINT    i; | UINT    i; |