// Plugin configuration void Plugin_About(HWND hwnd) { MessageBox(hwnd, _T("About"), _T("My title"), MB_ICONWARNING); forwarder->About(hwnd); }
INT_PTR CALLBACK ConfigurationDialogProc(__in HWND hWnd, __in UINT uMsg, __in WPARAM wParam, __in LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: { HWND mpdComboHwnd = ::GetDlgItem(hWnd, IDC_MPDOutFormat); #ifdef STREAMER_PAYD_VERSION TCHAR *value[] = { _T("WAVE Out"), _T("MP3 92 kbps"), _T("MP3 128 kbps"), _T("MP3 192 kbps"), _T("MP3 256 kbps"), _T("MP3 320 kbps") }; #else TCHAR *value[] = { _T("WAVE Out"), _T("MP3 64 kbps") }; #endif for(int i = 0 ; i<_countof(value) ; i++) { LONG_PTR index = ComboBox_AddString(mpdComboHwnd, value[i]); ComboBox_SetItemData(mpdComboHwnd, i, &i); } // Load settings Settings &settings = Global::Settings; wchar_t buff[0x400] = {}; Button_SetCheck(::GetDlgItem(hWnd, IDC_ForwarderEnable), settings.forward_output_sound); SetWindowTextA(::GetDlgItem(hWnd, IDC_MPDHost), settings.router_host.c_str()); swprintf_s(buff, _T("%d"), settings.router_port); Edit_SetText(::GetDlgItem(hWnd, IDC_MPDPort), buff); //ComboBox_SetCurSel(mpdComboHwnd, settings.PresetType); }break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_ForwarderAboutBtn: forwarder->About(hWnd); break; case IDC_ForwarderConfigBtn: forwarder->Config(hWnd); break; case IDOK: { HWND mpdComboHwnd = ::GetDlgItem(hWnd, IDC_MPDOutFormat); //Global::Settings. = ComboBox_GetCurSel(mpdComboHwnd); Global::Settings.write(); } case IDCANCEL: return EndDialog(hWnd, TRUE); } break; case WM_QUIT: return EndDialog(hWnd, TRUE); } return FALSE; }
INT_PTR CALLBACK ConfigurationDialogProc(__in HWND hWnd, __in UINT uMsg, __in WPARAM wParam, __in LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: { WCHAR buff[0x400] = {}; HWND mpdComboHwnd = ::GetDlgItem(hWnd, IDC_MPDOutFormat); for(int i=0 ;i<_countof(Mp3OutputStreamConstants::Presets) ; i++) { ::swprintf_s(buff, _T("MP3 %d kbps"), Mp3OutputStreamConstants::Presets[i]); LONG_PTR index = ComboBox_AddString(mpdComboHwnd, buff); ComboBox_SetItemData(mpdComboHwnd, i, &i); } ::SendMessage(::GetDlgItem(hWnd, IDC_OutputBuffer), TBM_SETRANGEMIN, FALSE, PrebufferTimeMinValue); ::SendMessage(::GetDlgItem(hWnd, IDC_OutputBuffer), TBM_SETRANGEMAX, FALSE, PrebufferTimeMaxValue); // Load settings const Settings &settings = Global::Settings; #ifdef STREAMER_PAYD_VERSION Button_SetCheck(::GetDlgItem(hWnd, IDC_ForwarderEnable), settings.forward_output_sound); ComboBox_SetCurSel(mpdComboHwnd, settings.encoder_preset); #else ComboBox_SetCurSel(mpdComboHwnd, 0); #endif ::SetWindowText(::GetDlgItem(hWnd, IDC_MPDHost), settings.router_host.c_str()); ::swprintf_s(buff, _T("%d"), settings.router_port); Edit_SetText(::GetDlgItem(hWnd, IDC_MPDPort), buff); ::SendMessage(::GetDlgItem(hWnd, IDC_OutputBuffer), TBM_SETPOS, TRUE, settings.output_buffer_lenght); ::swprintf_s(buff, _T("%d ms"), settings.output_buffer_lenght); ::SetWindowText(::GetDlgItem(hWnd, IDC_OutputBufferValue), buff); }break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_ForwarderAboutBtn: forwarder->About(hWnd); break; case IDC_ForwarderConfigBtn: forwarder->Config(hWnd); break; case IDOK: { HWND mpdComboHwnd = ::GetDlgItem(hWnd, IDC_MPDOutFormat); Settings &settings = Global::Settings; #ifdef STREAMER_PAYD_VERSION Global::Settings.encoder_preset = ComboBox_GetCurSel(mpdComboHwnd); Global::Settings.forward_output_sound = Button_GetCheck(::GetDlgItem(hWnd, IDC_ForwarderEnable)) == TRUE; #endif TCHAR buff[0x100] = {}; ::GetWindowText(::GetDlgItem(hWnd, IDC_MPDHost), buff, _countof(buff)); Global::Settings.router_host = buff; ::GetWindowText(::GetDlgItem(hWnd, IDC_MPDPort), buff, _countof(buff)); ::swscanf_s(buff, _T("%d"), &Global::Settings.router_port); settings.output_buffer_lenght = static_cast<int>(::SendMessage(::GetDlgItem(hWnd, IDC_OutputBuffer), TBM_GETPOS, 0, 0)); Global::Settings.write(); } case IDCANCEL: return EndDialog(hWnd, TRUE); } break; case WM_HSCROLL: if (LOWORD(wParam) == SB_THUMBTRACK) { TCHAR buff[10] = {}; Global::Settings.output_buffer_lenght = HIWORD(wParam); ::swprintf_s(buff, _T("%d ms"), Global::Settings.output_buffer_lenght); ::SetWindowText(::GetDlgItem(hWnd, IDC_OutputBufferValue), buff); } break; case WM_QUIT: return EndDialog(hWnd, TRUE); } return FALSE; }