--- np2/win9x/dialog/dialogs.cpp 2007/11/11 11:00:02 1.13 +++ np2/win9x/dialog/dialogs.cpp 2011/03/07 09:54:11 1.18 @@ -1,19 +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"); - +#if !defined(__GNUC__) +#pragma comment(lib, "winmm.lib") +#endif // !defined(__GNUC__) // ---- enable @@ -37,7 +45,6 @@ static BOOL openFileParam(LPOPENFILENAME OEMCHAR *pszPath, UINT uSize, BOOL (WINAPI * fnAPI)(LPOPENFILENAME lpofn)) { - HINSTANCE hInstance; LPTSTR lpszTitle; LPTSTR lpszFilter; LPTSTR lpszDefExt; @@ -53,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 @@ -68,7 +73,7 @@ static BOOL openFileParam(LPOPENFILENAME if (!HIWORD(pcParam->lpszFilter)) { - lpszFilter = lockstringresource(hInstance, pcParam->lpszFilter); + lpszFilter = lockstringresource(pcParam->lpszFilter); lpOFN->lpstrFilter = lpszFilter; } else @@ -79,7 +84,7 @@ static BOOL openFileParam(LPOPENFILENAME if (!HIWORD(pcParam->lpszDefExt)) { - lpszDefExt = lockstringresource(hInstance, pcParam->lpszDefExt); + lpszDefExt = lockstringresource(pcParam->lpszDefExt); lpOFN->lpstrDefExt = lpszDefExt; } else @@ -288,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; @@ -299,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)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)pItem[i].nItemData); + (WPARAM)nIndex, (LPARAM)pcItem[i].nItemData); } } } @@ -325,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; } @@ -353,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; @@ -365,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; @@ -412,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