revive that "dead" EN_CHANGE code in a new callback

I have absolutely no idea how the old version ever worked!
Seriously, it makes no sense. It checked if the HIWORD of wParam equaled
EN_CHANGE even though it was in a BN_CLICKED case...but it still got the events.
This implies that BN_CLICKED == EN_CHANGE, but 0 very much does not equal 0x300.
This commit is contained in:
warmCabin 2021-06-28 06:29:57 -04:00
parent fc60358f79
commit cd13ee29f7
1 changed files with 19 additions and 24 deletions

View File

@ -1831,30 +1831,6 @@ void DebuggerBnClicked(HWND hwndDlg, uint16 btnId, HWND hwndBtn)
SendDlgItemMessage(hwndDlg, IDC_DEBUGGER_DISASSEMBLY, WM_SETFONT, (WPARAM)debugSystem->hDisasmFont, FALSE);
UpdateDebugger(false);
break;
case IDC_DEBUGGER_CYCLES_EXCEED:
{
// Pretty sure this was dead code. BN_CLICKED is not equal to EN_CHANGE.
// Does it need to be moved to an EN_CHANGED callback?
//if (HIWORD(wParam) == EN_CHANGE)
//{
// char str[16];
// GetDlgItemText(hwndDlg, IDC_DEBUGGER_CYCLES_EXCEED, str, 16);
// break_cycles_limit = strtoul(str, NULL, 10);
//}
break;
}
case IDC_DEBUGGER_INSTRUCTIONS_EXCEED:
{
// Pretty sure this was dead code. BN_CLICKED is not equal to EN_CHANGE.
// Does it need to be moved to an EN_CHANGED callback?
//if (HIWORD(wParam) == EN_CHANGE)
//{
// char str[16];
// GetDlgItemText(hwndDlg, IDC_DEBUGGER_INSTRUCTIONS_EXCEED, str, 16);
// break_instructions_limit = strtoul(str, NULL, 10);
//}
break;
}
case ID_DEBUGGER_DEFCOLOR:
{
if (!IsDebugColorDefault() && MessageBox(hwndDlg, "Do you want to restore all the colors to default?", "Restore default colors", MB_YESNO | MB_ICONINFORMATION) == IDYES)
@ -2470,6 +2446,22 @@ void DebuggerMButtonDown(HWND hwndDlg, int cursorX, int cursorY, int vkFlags)
}
}
void DebuggerEnChange(HWND hwndDlg, uint16 textBoxId, HWND hwndTextbox)
{
char str[16];
switch (textBoxId)
{
case IDC_DEBUGGER_CYCLES_EXCEED:
GetDlgItemText(hwndDlg, IDC_DEBUGGER_CYCLES_EXCEED, str, 16);
break_cycles_limit = strtoul(str, NULL, 10);
break;
case IDC_DEBUGGER_INSTRUCTIONS_EXCEED:
GetDlgItemText(hwndDlg, IDC_DEBUGGER_INSTRUCTIONS_EXCEED, str, 16);
break_instructions_limit = strtoul(str, NULL, 10);
break;
}
}
INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
@ -2504,6 +2496,9 @@ INT_PTR CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
case LBN_SELCHANGE:
DebuggerSelChange(hwndDlg, LOWORD(wParam), (HWND)lParam);
break;
case EN_CHANGE:
DebuggerEnChange(hwndDlg, LOWORD(wParam), (HWND)lParam);
break;
}
case WM_INITMENUPOPUP:
DebuggerInitMenuPopup(hwndDlg, (HMENU)wParam, LOWORD(lParam), HIWORD(lParam));