| version 1.14, 2007/12/16 14:58:25 | version 1.18, 2011/03/07 09:54:11 | 
| Line 1 | Line 1 | 
| #include        "compiler.h" | /** | 
| #include        "resource.h" | * @file        dialogs.cpp | 
| #include        "strres.h" | * @brief       Dialog subroutines | 
| #include        "bmpdata.h" | * | 
| #include        "oemtext.h" | * @author      $Author$ | 
| #include        "dosio.h" | * @date        $Date$ | 
| #include        "commng.h" | */ | 
| #include        "dialogs.h" |  | 
| #include        "np2.h" | #include "compiler.h" | 
|  | #include "resource.h" | 
|  | #include "strres.h" | 
|  | #include "bmpdata.h" | 
|  | #include "oemtext.h" | 
|  | #include "dosio.h" | 
|  | #include "commng.h" | 
|  | #include "dialogs.h" | 
|  | #include "np2.h" | 
 | #if defined(MT32SOUND_DLL) | #if defined(MT32SOUND_DLL) | 
| #include        "mt32snd.h" | #include "mt32snd.h" | 
 | #endif | #endif | 
 |  |  | 
|  | #if !defined(__GNUC__) | 
| const TCHAR str_nc[] = _T("N/C"); | #pragma comment(lib, "winmm.lib") | 
|  | #endif  // !defined(__GNUC__) | 
 |  |  | 
 | // ---- enable | // ---- enable | 
 |  |  | 
| Line 37  static BOOL openFileParam(LPOPENFILENAME | Line 45  static BOOL openFileParam(LPOPENFILENAME | 
 | OEMCHAR *pszPath, UINT uSize, | OEMCHAR *pszPath, UINT uSize, | 
 | BOOL (WINAPI * fnAPI)(LPOPENFILENAME lpofn)) | BOOL (WINAPI * fnAPI)(LPOPENFILENAME lpofn)) | 
 | { | { | 
 | HINSTANCE       hInstance; |  | 
 | LPTSTR          lpszTitle; | LPTSTR          lpszTitle; | 
 | LPTSTR          lpszFilter; | LPTSTR          lpszFilter; | 
 | LPTSTR          lpszDefExt; | LPTSTR          lpszDefExt; | 
| Line 53  static BOOL openFileParam(LPOPENFILENAME | Line 60  static BOOL openFileParam(LPOPENFILENAME | 
 | return FALSE; | return FALSE; | 
 | } | } | 
 |  |  | 
 | hInstance = g_hInstance; |  | 
 |  |  | 
 | if (!HIWORD(pcParam->lpszTitle)) | if (!HIWORD(pcParam->lpszTitle)) | 
 | { | { | 
| lpszTitle = lockstringresource(hInstance, pcParam->lpszTitle); | lpszTitle = lockstringresource(pcParam->lpszTitle); | 
 | lpOFN->lpstrTitle = lpszTitle; | lpOFN->lpstrTitle = lpszTitle; | 
 | } | } | 
 | else | else | 
| Line 68  static BOOL openFileParam(LPOPENFILENAME | Line 73  static BOOL openFileParam(LPOPENFILENAME | 
 |  |  | 
 | if (!HIWORD(pcParam->lpszFilter)) | if (!HIWORD(pcParam->lpszFilter)) | 
 | { | { | 
| lpszFilter = lockstringresource(hInstance, pcParam->lpszFilter); | lpszFilter = lockstringresource(pcParam->lpszFilter); | 
 | lpOFN->lpstrFilter = lpszFilter; | lpOFN->lpstrFilter = lpszFilter; | 
 | } | } | 
 | else | else | 
| Line 79  static BOOL openFileParam(LPOPENFILENAME | Line 84  static BOOL openFileParam(LPOPENFILENAME | 
 |  |  | 
 | if (!HIWORD(pcParam->lpszDefExt)) | if (!HIWORD(pcParam->lpszDefExt)) | 
 | { | { | 
| lpszDefExt = lockstringresource(hInstance, pcParam->lpszDefExt); | lpszDefExt = lockstringresource(pcParam->lpszDefExt); | 
 | lpOFN->lpstrDefExt = lpszDefExt; | lpOFN->lpstrDefExt = lpszDefExt; | 
 | } | } | 
 | else | else | 
| Line 302  void dlgs_setcbitem(HWND hWnd, UINT uID, | Line 307  void dlgs_setcbitem(HWND hWnd, UINT uID, | 
 | lpcszStr = pcItem[i].lpcszString; | lpcszStr = pcItem[i].lpcszString; | 
 | if (!HIWORD(lpcszStr)) | if (!HIWORD(lpcszStr)) | 
 | { | { | 
| if (!loadstringresource(g_hInstance, LOWORD(lpcszStr), | if (!loadstringresource(LOWORD(lpcszStr), | 
 | szString, NELEMENTS(szString))) | szString, NELEMENTS(szString))) | 
 | { | { | 
 | continue; | continue; | 
 | } | } | 
 | lpcszStr = szString; | lpcszStr = szString; | 
 | } | } | 
| nIndex = SendMessage(hItem, CB_ADDSTRING, 0, (LPARAM)lpcszStr); | nIndex = (int)SendMessage(hItem, CB_ADDSTRING, 0, (LPARAM)lpcszStr); | 
 | if (nIndex >= 0) | if (nIndex >= 0) | 
 | { | { | 
 | SendMessage(hItem, CB_SETITEMDATA, | SendMessage(hItem, CB_SETITEMDATA, | 
| Line 329  void dlgs_setcbnumber(HWND hWnd, UINT uI | Line 334  void dlgs_setcbnumber(HWND hWnd, UINT uI | 
 | for (i=0; i<uItems; i++) | for (i=0; i<uItems; i++) | 
 | { | { | 
 | wsprintf(szValue, str_u, pcItem[i].uValue); | wsprintf(szValue, str_u, pcItem[i].uValue); | 
| nIndex = SendMessage(hItem, CB_ADDSTRING, 0, (LPARAM)szValue); | nIndex = (int)SendMessage(hItem, CB_ADDSTRING, 0, (LPARAM)szValue); | 
 | if (nIndex >= 0) | if (nIndex >= 0) | 
 | { | { | 
 | SendMessage(hItem, CB_SETITEMDATA, | SendMessage(hItem, CB_SETITEMDATA, | 
| Line 345  void dlgs_setcbcur(HWND hWnd, UINT uID, | Line 350  void dlgs_setcbcur(HWND hWnd, UINT uID, | 
 | int             i; | int             i; | 
 |  |  | 
 | hItem = GetDlgItem(hWnd, uID); | hItem = GetDlgItem(hWnd, uID); | 
| nItems = SendMessage(hItem, CB_GETCOUNT, 0, 0); | nItems = (int)SendMessage(hItem, CB_GETCOUNT, 0, 0); | 
 | for (i=0; i<nItems; i++) | for (i=0; i<nItems; i++) | 
 | { | { | 
 | if (SendMessage(hItem, CB_GETITEMDATA, (WPARAM)i, 0) == nItemData) | if (SendMessage(hItem, CB_GETITEMDATA, (WPARAM)i, 0) == nItemData) | 
| Line 362  int dlgs_getcbcur(HWND hWnd, UINT uID, i | Line 367  int dlgs_getcbcur(HWND hWnd, UINT uID, i | 
 | int             nPos; | int             nPos; | 
 |  |  | 
 | hItem = GetDlgItem(hWnd, uID); | hItem = GetDlgItem(hWnd, uID); | 
| nPos = SendMessage(hItem, CB_GETCURSEL, 0, 0); | nPos = (int)SendMessage(hItem, CB_GETCURSEL, 0, 0); | 
 | if (nPos >= 0) | if (nPos >= 0) | 
 | { | { | 
| return SendMessage(hItem, CB_GETITEMDATA, (WPARAM)nPos, 0); | return (int)SendMessage(hItem, CB_GETITEMDATA, (WPARAM)nPos, 0); | 
 | } | } | 
 | return nDefault; | return nDefault; | 
 | } | } | 
| Line 373  int dlgs_getcbcur(HWND hWnd, UINT uID, i | Line 378  int dlgs_getcbcur(HWND hWnd, UINT uID, i | 
 |  |  | 
 | // ---- MIDIデバイスのリスト | // ---- MIDIデバイスのリスト | 
 |  |  | 
 |  | static void insertnc(HWND hWnd, int nPos) | 
 |  | { | 
 |  | TCHAR   szNC[128]; | 
 |  |  | 
 |  | loadstringresource(LOWORD(IDS_NONCONNECT), szNC, NELEMENTS(szNC)); | 
 |  | SendMessage(hWnd, CB_INSERTSTRING, (WPARAM)nPos, (LPARAM)szNC); | 
 |  | } | 
 |  |  | 
 | void dlgs_setlistmidiout(HWND hWnd, UINT16 res, const OEMCHAR *defname) { | void dlgs_setlistmidiout(HWND hWnd, UINT16 res, const OEMCHAR *defname) { | 
 |  |  | 
 | HWND            wnd; | HWND            wnd; | 
| Line 385  void dlgs_setlistmidiout(HWND hWnd, UINT | Line 398  void dlgs_setlistmidiout(HWND hWnd, UINT | 
 | wnd = GetDlgItem(hWnd, res); | wnd = GetDlgItem(hWnd, res); | 
 | defcur = 0; | defcur = 0; | 
 | devs = midiOutGetNumDevs(); | devs = midiOutGetNumDevs(); | 
| SendMessage(wnd, CB_INSERTSTRING, (WPARAM)0, (LPARAM)str_nc); | insertnc(wnd, 0); | 
 | SendMessage(wnd, CB_INSERTSTRING, (WPARAM)1, (LPARAM)cmmidi_midimapper); | SendMessage(wnd, CB_INSERTSTRING, (WPARAM)1, (LPARAM)cmmidi_midimapper); | 
 | if (!milstr_cmp(defname, cmmidi_midimapper)) { | if (!milstr_cmp(defname, cmmidi_midimapper)) { | 
 | defcur = 1; | defcur = 1; | 
| Line 432  void dlgs_setlistmidiin(HWND hWnd, UINT1 | Line 445  void dlgs_setlistmidiin(HWND hWnd, UINT1 | 
 | wnd = GetDlgItem(hWnd, res); | wnd = GetDlgItem(hWnd, res); | 
 | defcur = 0; | defcur = 0; | 
 | num = midiInGetNumDevs(); | num = midiInGetNumDevs(); | 
| SendMessage(wnd, CB_INSERTSTRING, (WPARAM)0, (LPARAM)str_nc); | insertnc(wnd, 0); | 
 | for (i=0; i<num; i++) { | for (i=0; i<num; i++) { | 
 | if (midiInGetDevCaps(i, &mic, sizeof(mic)) == MMSYSERR_NOERROR) { | if (midiInGetDevCaps(i, &mic, sizeof(mic)) == MMSYSERR_NOERROR) { | 
 | SendMessage(wnd, CB_INSERTSTRING, | SendMessage(wnd, CB_INSERTSTRING, |