win32: do not immediately apply automatic input rate checkbox

This commit is contained in:
OV2 2018-12-15 14:24:20 +01:00
parent 3832ec3607
commit 879ad3e119
1 changed files with 20 additions and 21 deletions

View File

@ -4588,29 +4588,28 @@ INT_PTR CALLBACK DlgSoundConf(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
return true;
case IDC_AUTOMATICINPUTRATE:
GUI.AutomaticInputRate = IsDlgButtonChecked(hDlg, IDC_AUTOMATICINPUTRATE);
EnableWindow(GetDlgItem(hDlg, IDC_INRATEEDIT), !GUI.AutomaticInputRate);
EnableWindow(GetDlgItem(hDlg, IDC_INRATE), !GUI.AutomaticInputRate);
{
bool temp_auto_input_rate = IsDlgButtonChecked(hDlg, IDC_AUTOMATICINPUTRATE);
EnableWindow(GetDlgItem(hDlg, IDC_INRATEEDIT), !temp_auto_input_rate);
EnableWindow(GetDlgItem(hDlg, IDC_INRATE), !temp_auto_input_rate);
if (GUI.AutomaticInputRate)
if (temp_auto_input_rate)
{
int newrate = WinGetAutomaticInputRate();
if (newrate)
{
Settings.SoundInputRate = newrate;
SendDlgItemMessage(hDlg, IDC_INRATE, TBM_SETPOS, TRUE, (Settings.SoundInputRate - 31100) / 50);
_sntprintf(valTxt, 10, TEXT("%d"), Settings.SoundInputRate);
SendDlgItemMessage(hDlg, IDC_INRATE, TBM_SETPOS, TRUE, (newrate - 31100) / 50);
_sntprintf(valTxt, 10, TEXT("%d"), newrate);
Edit_SetText(GetDlgItem(hDlg, IDC_INRATEEDIT), valTxt);
}
else
{
GUI.AutomaticInputRate = false;
SendDlgItemMessage(hDlg, IDC_AUTOMATICINPUTRATE, BM_SETCHECK, BST_UNCHECKED, 0);
}
}
return true;
}
case IDC_DRIVER:
if(CBN_SELCHANGE==HIWORD(wParam))
{