Diff for /np2/win9x/dialog/dialogs.cpp between versions 1.3 and 1.9

version 1.3, 2003/11/21 06:51:14 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"
   #if defined(MT32SOUND_DLL)
   #include        "mt32snd.h"
   #endif
   
   
 static const char str_nc[] = "N/C";  const TCHAR str_nc[] = _T("N/C");
   
 // static       char    pathname[MAX_PATH];  
 // static       char    filename[MAX_PATH];  
   
 const char str_int0[] = "INT0";  const TCHAR str_int0[] = _T("INT0");
 const char str_int1[] = "INT1";  const TCHAR str_int1[] = _T("INT1");
 const char str_int2[] = "INT2";  const TCHAR str_int2[] = _T("INT2");
 const char str_int4[] = "INT4";  const TCHAR str_int4[] = _T("INT4");
 const char str_int5[] = "INT5";  const TCHAR str_int5[] = _T("INT5");
 const char str_int6[] = "INT6";  const TCHAR str_int6[] = _T("INT6");
   
   
 // ---- file select  // ---- file select
   
 BOOL dlgs_selectfile(HWND hWnd, const FILESEL *item,  BOOL dlgs_selectfile(HWND hWnd, const FILESEL *item,
                                                                                         char *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 49  BOOL dlgs_selectfile(HWND hWnd, const FI Line 62  BOOL dlgs_selectfile(HWND hWnd, const FI
 }  }
   
 BOOL dlgs_selectwritefile(HWND hWnd, const FILESEL *item,  BOOL dlgs_selectwritefile(HWND hWnd, const FILESEL *item,
                                                                                         char *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);
 }  }
   
 BOOL dlgs_selectwritenum(HWND hWnd, const FILESEL *item,  BOOL dlgs_selectwritenum(HWND hWnd, const FILESEL *item,
                                                                                         char *path, UINT size) {                                                                                          OEMCHAR *path, UINT size) {
   
         char    *file;          OEMCHAR *file;
         char    *p;          OEMCHAR *p;
         char    *q;          OEMCHAR *q;
         UINT    i;          UINT    i;
         BOOL    r;          BOOL    r;
   
         if ((item == NULL) || (path == NULL) || (size == 0)) {          if ((item == NULL) || (path == NULL) || (size == 0)) {
                 return(FALSE);                  return(FALSE);
         }          }
         file = (char *)_MALLOC(size + 16, path);          file = (OEMCHAR *)_MALLOC((size + 16) * sizeof(OEMCHAR), path);
         if (file == NULL) {          if (file == NULL) {
                 return(FALSE);                  return(FALSE);
         }          }
         p = file_getname(path);          p = file_getname(path);
         milstr_ncpy(file, path, size);          milstr_ncpy(file, path, size);
         file_cutname(file);          file_cutname(file);
         q = file + strlen(file);          q = file + OEMSTRLEN(file);
   
         for (i=0; i<10000; i++) {          for (i=0; i<10000; i++) {
                 SPRINTF(q, p, i);                  OEMSPRINTF(q, p, i);
                 if (file_attr(file) == (short)-1) {                  if (file_attr(file) == (short)-1) {
                         break;                          break;
                 }                  }
Line 110  BOOL dlgs_selectwritenum(HWND hWnd, cons Line 135  BOOL dlgs_selectwritenum(HWND hWnd, cons
   
 // ---- mimpi def file  // ---- mimpi def file
   
 static const char mimpi_title[] = "Open MIMPI define file";  static const TCHAR mimpi_title[] = _T("Open MIMPI define file");
 static const char mimpi_ext[] = "def";  static const TCHAR mimpi_ext[] = _T("def");
 static const char mimpi_filter[] = "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, WORD res) {  void dlgs_browsemimpidef(HWND hWnd, UINT16 res) {
   
         HWND    subwnd;          HWND            subwnd;
         char    path[MAX_PATH];          OEMCHAR         path[MAX_PATH];
 const char      *p;  const OEMCHAR   *p;
   
         subwnd = GetDlgItem(hWnd, res);          subwnd = GetDlgItem(hWnd, res);
         GetWindowText(subwnd, path, sizeof(path));          GetWindowText(subwnd, path, NELEMENTS(path));
         if (dlgs_selectfile(hWnd, &mimpi, path, sizeof(path), NULL)) {          if (dlgs_selectfile(hWnd, &mimpi, path, NELEMENTS(path), NULL)) {
                 p = path;                  p = path;
         }          }
         else {          else {
Line 135  const char *p; Line 160  const char *p;
   
 // ---- list  // ---- list
   
 void dlgs_setliststr(HWND hWnd, WORD res, const char **item, UINT items) {  void dlgs_setliststr(HWND hWnd, UINT16 res, const TCHAR **item, UINT items) {
   
         HWND    wnd;          HWND    wnd;
         UINT    i;          UINT    i;
Line 146  void dlgs_setliststr(HWND hWnd, WORD res Line 171  void dlgs_setliststr(HWND hWnd, WORD res
         }          }
 }  }
   
 void dlgs_setlistuint32(HWND hWnd, WORD res, const UINT32 *item, UINT items) {  void dlgs_setlistuint32(HWND hWnd, UINT16 res, const UINT32 *item, UINT items) {
   
         HWND    wnd;          HWND    wnd;
         UINT    i;          UINT    i;
         char    str[16];          OEMCHAR str[16];
   
         wnd = GetDlgItem(hWnd, res);          wnd = GetDlgItem(hWnd, res);
         for (i=0; i<items; i++) {          for (i=0; i<items; i++) {
                 wsprintf(str, str_u, item[i]);                  OEMSPRINTF(str, str_u, item[i]);
                 SendMessage(wnd, CB_INSERTSTRING, (WPARAM)i, (LPARAM)str);                  SendMessage(wnd, CB_INSERTSTRING, (WPARAM)i, (LPARAM)str);
         }          }
 }  }
Line 162  void dlgs_setlistuint32(HWND hWnd, WORD  Line 187  void dlgs_setlistuint32(HWND hWnd, WORD 
   
 // ---- MIDIデバイスのリスト  // ---- MIDIデバイスのリスト
   
 void dlgs_setlistmidiout(HWND hWnd, WORD res, const char *defname) {  void dlgs_setlistmidiout(HWND hWnd, UINT16 res, const OEMCHAR *defname) {
   
         HWND            wnd;          HWND            wnd;
         UINT            defcur;          UINT            defcur;
Line 187  void dlgs_setlistmidiout(HWND hWnd, WORD Line 212  void dlgs_setlistmidiout(HWND hWnd, WORD
         }          }
         num++;          num++;
 #endif  #endif
   #if defined(MT32SOUND_DLL)
           if (mt32sound_isenable()) {
                   SendMessage(wnd, CB_INSERTSTRING, (WPARAM)num,
                                                                                                           (LPARAM)cmmidi_mt32sound);
                   if (!milstr_cmp(defname, cmmidi_mt32sound)) {
                           defcur = num;
                   }
                   num++;
           }
   #endif
         for (i=0; i<devs; i++) {          for (i=0; i<devs; i++) {
                 if (midiOutGetDevCaps(i, &moc, sizeof(moc)) == MMSYSERR_NOERROR) {                  if (midiOutGetDevCaps(i, &moc, sizeof(moc)) == MMSYSERR_NOERROR) {
                         SendMessage(wnd, CB_INSERTSTRING,                          SendMessage(wnd, CB_INSERTSTRING,
Line 200  void dlgs_setlistmidiout(HWND hWnd, WORD Line 235  void dlgs_setlistmidiout(HWND hWnd, WORD
         SendMessage(wnd, CB_SETCURSEL, (WPARAM)defcur, (LPARAM)0);          SendMessage(wnd, CB_SETCURSEL, (WPARAM)defcur, (LPARAM)0);
 }  }
   
 void dlgs_setlistmidiin(HWND hWnd, WORD res, const char *defname) {  void dlgs_setlistmidiin(HWND hWnd, UINT16 res, const OEMCHAR *defname) {
   
         HWND            wnd;          HWND            wnd;
         UINT            defcur;          UINT            defcur;
Line 227  void dlgs_setlistmidiin(HWND hWnd, WORD  Line 262  void dlgs_setlistmidiin(HWND hWnd, WORD 
   
 // ---- draw  // ---- draw
   
 void dlgs_drawbmp(HDC hdc, BYTE *bmp) {  void dlgs_drawbmp(HDC hdc, UINT8 *bmp) {
   
         BMPFILE         *bf;          BMPFILE         *bf;
         BMPINFO         *bi;          BMPINFO         *bi;
         BMPDATA         inf;          BMPDATA         inf;
         HBITMAP         hbmp;          HBITMAP         hbmp;
         BYTE            *image;          UINT8           *image;
         HDC                     hmdc;          HDC                     hmdc;
   
         if (bmp == NULL) {          if (bmp == NULL) {

Removed from v.1.3  
changed lines
  Added in v.1.9


RetroPC.NET-CVS <cvs@retropc.net>