|
|
| version 1.8, 2005/03/20 13:12:50 | version 1.9, 2005/03/20 23:48:03 |
|---|---|
| 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 25 BOOL dlgs_selectfile(HWND hWnd, const FI | Line 26 BOOL dlgs_selectfile(HWND hWnd, const FI |
| OEMCHAR *path, UINT size, int *ro) { | OEMCHAR *path, UINT size, int *ro) { |
| OPENFILENAME ofn; | OPENFILENAME ofn; |
| #if defined(OSLANG_UTF8) | |
| TCHAR _path[MAX_PATH]; | |
| #endif | |
| if ((item == NULL) || (path == NULL) || (size == 0)) { | if ((item == NULL) || (path == NULL) || (size == 0)) { |
| return(FALSE); | return(FALSE); |
| Line 34 BOOL dlgs_selectfile(HWND hWnd, const FI | Line 38 BOOL dlgs_selectfile(HWND hWnd, const FI |
| 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 = item->title; |
| if (!GetOpenFileName(&ofn)) { | if (!GetOpenFileName(&ofn)) { |
| return(FALSE); | return(FALSE); |
| } | } |
| #if defined(OSLANG_UTF8) | |
| tchartooem(path, NELEMENTS(path), _path, -1); | |
| #endif | |
| if (ro) { | if (ro) { |
| *ro = ofn.Flags & OFN_READONLY; | *ro = ofn.Flags & OFN_READONLY; |
| } | } |
| Line 52 BOOL dlgs_selectwritefile(HWND hWnd, con | Line 65 BOOL dlgs_selectwritefile(HWND hWnd, con |
| OEMCHAR *path, UINT size) { | OEMCHAR *path, UINT size) { |
| OPENFILENAME ofn; | OPENFILENAME ofn; |
| #if defined(OSLANG_UTF8) | |
| TCHAR _path[MAX_PATH]; | |
| #endif | |
| if ((item == NULL) || (path == NULL) || (size == 0)) { | if ((item == NULL) || (path == NULL) || (size == 0)) { |
| return(FALSE); | return(FALSE); |
| Line 61 BOOL dlgs_selectwritefile(HWND hWnd, con | Line 77 BOOL dlgs_selectwritefile(HWND hWnd, con |
| 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 = item->title; |
| if (!GetSaveFileName(&ofn)) { | if (!GetSaveFileName(&ofn)) { |
| return(FALSE); | return(FALSE); |
| } | } |
| #if defined(OSLANG_UTF8) | |
| tchartooem(path, NELEMENTS(path), _path, -1); | |
| #endif | |
| return(TRUE); | return(TRUE); |
| } | } |