--- np2/win9x/dialog/dialogs.cpp 2007/11/11 07:11:28 1.12 +++ np2/win9x/dialog/dialogs.cpp 2011/03/07 09:54:11 1.18 @@ -1,26 +1,27 @@ -#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" +/** + * @file dialogs.cpp + * @brief Dialog subroutines + * + * @author $Author: yui $ + * @date $Date: 2011/03/07 09:54:11 $ + */ + +#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) -#include "mt32snd.h" +#include "mt32snd.h" #endif - -const TCHAR str_nc[] = _T("N/C"); - -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"); - +#if !defined(__GNUC__) +#pragma comment(lib, "winmm.lib") +#endif // !defined(__GNUC__) // ---- enable @@ -44,7 +45,6 @@ static BOOL openFileParam(LPOPENFILENAME OEMCHAR *pszPath, UINT uSize, BOOL (WINAPI * fnAPI)(LPOPENFILENAME lpofn)) { - HINSTANCE hInstance; LPTSTR lpszTitle; LPTSTR lpszFilter; LPTSTR lpszDefExt; @@ -60,11 +60,9 @@ static BOOL openFileParam(LPOPENFILENAME return FALSE; } - hInstance = g_hInstance; - if (!HIWORD(pcParam->lpszTitle)) { - lpszTitle = lockstringresource(hInstance, pcParam->lpszTitle); + lpszTitle = lockstringresource(pcParam->lpszTitle); lpOFN->lpstrTitle = lpszTitle; } else @@ -75,7 +73,7 @@ static BOOL openFileParam(LPOPENFILENAME if (!HIWORD(pcParam->lpszFilter)) { - lpszFilter = lockstringresource(hInstance, pcParam->lpszFilter); + lpszFilter = lockstringresource(pcParam->lpszFilter); lpOFN->lpstrFilter = lpszFilter; } else @@ -86,7 +84,7 @@ static BOOL openFileParam(LPOPENFILENAME if (!HIWORD(pcParam->lpszDefExt)) { - lpszDefExt = lockstringresource(hInstance, pcParam->lpszDefExt); + lpszDefExt = lockstringresource(pcParam->lpszDefExt); lpOFN->lpstrDefExt = lpszDefExt; } else @@ -208,7 +206,7 @@ BOOL dlgs_createfilenum(HWND hWnd, PCFSP uCount = 0; while(1) { - pszFile = milsjis_chr(pszPath, '#'); + pszFile = milstr_chr(pszPath, '#'); if (!pszFile) { break; @@ -295,7 +293,7 @@ void dlgs_setlistuint32(HWND hWnd, UINT1 } } -void dlgs_setcbitem(HWND hWnd, UINT uID, PCCBPARAM pItem, UINT uItems) +void dlgs_setcbitem(HWND hWnd, UINT uID, PCCBPARAM pcItem, UINT uItems) { HWND hItem; UINT i; @@ -306,21 +304,41 @@ void dlgs_setcbitem(HWND hWnd, UINT uID, hItem = GetDlgItem(hWnd, uID); for (i=0; i= 0) { SendMessage(hItem, CB_SETITEMDATA, - (WPARAM)nIndex, (LPARAM)pItem[i].nItemData); + (WPARAM)nIndex, (LPARAM)pcItem[i].nItemData); + } + } +} + +void dlgs_setcbnumber(HWND hWnd, UINT uID, PCCBNPARAM pcItem, UINT uItems) +{ + HWND hItem; + UINT i; + TCHAR szValue[16]; + int nIndex; + + hItem = GetDlgItem(hWnd, uID); + for (i=0; i= 0) + { + SendMessage(hItem, CB_SETITEMDATA, + (WPARAM)nIndex, (LPARAM)pcItem[i].nItemData); } } } @@ -332,7 +350,7 @@ void dlgs_setcbcur(HWND hWnd, UINT uID, int i; hItem = GetDlgItem(hWnd, uID); - nItems = SendMessage(hItem, CB_GETCOUNT, 0, 0); + nItems = (int)SendMessage(hItem, CB_GETCOUNT, 0, 0); for (i=0; i= 0) { - return SendMessage(hItem, CB_GETITEMDATA, (WPARAM)nPos, 0); + return (int)SendMessage(hItem, CB_GETITEMDATA, (WPARAM)nPos, 0); } return nDefault; } @@ -360,6 +378,14 @@ int dlgs_getcbcur(HWND hWnd, UINT uID, i // ---- 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) { HWND wnd; @@ -372,7 +398,7 @@ void dlgs_setlistmidiout(HWND hWnd, UINT wnd = GetDlgItem(hWnd, res); defcur = 0; devs = midiOutGetNumDevs(); - SendMessage(wnd, CB_INSERTSTRING, (WPARAM)0, (LPARAM)str_nc); + insertnc(wnd, 0); SendMessage(wnd, CB_INSERTSTRING, (WPARAM)1, (LPARAM)cmmidi_midimapper); if (!milstr_cmp(defname, cmmidi_midimapper)) { defcur = 1; @@ -419,7 +445,7 @@ void dlgs_setlistmidiin(HWND hWnd, UINT1 wnd = GetDlgItem(hWnd, res); defcur = 0; num = midiInGetNumDevs(); - SendMessage(wnd, CB_INSERTSTRING, (WPARAM)0, (LPARAM)str_nc); + insertnc(wnd, 0); for (i=0; i