[idd] helper: add mode list reset button

This commit is contained in:
Quantum
2026-06-03 01:52:34 -04:00
committed by Geoffrey McRae
parent 415a946e56
commit 708ed2cbae
2 changed files with 12 additions and 1 deletions

View File

@@ -88,7 +88,7 @@ void CConfigWindow::updateFont()
for (HWND child : std::initializer_list<HWND>({
*m_version, *m_modeGroup, *m_modeBox, *m_widthLabel, *m_heightLabel, *m_refreshLabel,
*m_modeWidth, *m_modeHeight, *m_modeRefresh, *m_modeUpdate, *m_modeDelete,
*m_modeWidth, *m_modeHeight, *m_modeRefresh, *m_modeUpdate, *m_modeDelete, *m_modeReset,
*m_autosizeGroup, *m_defRefreshLabel, *m_defRefresh, *m_defRefreshHz,
}))
SendMessage(child, WM_SETFONT, (WPARAM)m_font.Get(), 1);
@@ -154,6 +154,7 @@ LRESULT CConfigWindow::onCreate()
m_modeUpdate.reset(new CButton(L"Save", WS_CHILD | WS_VISIBLE | WS_TABSTOP, m_hwnd));
m_modeDelete.reset(new CButton(L"Delete", WS_CHILD | WS_VISIBLE | WS_TABSTOP, m_hwnd));
m_modeReset.reset(new CButton(L"Reset", WS_CHILD | WS_VISIBLE | WS_TABSTOP, m_hwnd));
EnableWindow(*m_modeUpdate, FALSE);
EnableWindow(*m_modeDelete, FALSE);
@@ -198,6 +199,7 @@ LRESULT CConfigWindow::onResize(DWORD width, DWORD height)
pos.pinBottomLeft(*m_modeRefresh, 75, 48, 50, 20);
pos.pinBottomLeft(*m_modeUpdate, 24, 20, 50, 24);
pos.pinBottomLeft(*m_modeDelete, 75, 20, 50, 24);
pos.pinBottomLeft(*m_modeReset, 126, 20, 50, 24);
pos.pinTopLeft(*m_autosizeGroup, 224, 40, 200, 52);
pos.pinTopLeft(*m_defRefreshLabel, 236, 64, 95, 20);
@@ -281,6 +283,14 @@ LRESULT CConfigWindow::onCommand(WORD id, WORD code, HWND hwnd)
updateModeList();
onModeListSelectChange();
}
else if (m_modeReset && hwnd == *m_modeReset && code == BN_CLICKED && m_modes)
{
*m_modes = m_settings.getDefaultModes();
m_settings.setModes(*m_modes);
m_modeBox->clear();
updateModeList();
onModeListSelectChange();
}
else if (m_defRefresh && hwnd == *m_defRefresh && code == EN_CHANGE && m_defaultRefresh)
{
int value;

View File

@@ -51,6 +51,7 @@ class CConfigWindow : public CWindow
std::unique_ptr<CButton> m_modeUpdate;
std::unique_ptr<CButton> m_modeDelete;
std::unique_ptr<CButton> m_modeReset;
std::unique_ptr<CGroupBox> m_autosizeGroup;
std::unique_ptr<CStaticWidget> m_defRefreshLabel;