From: <sv...@op...> - 2025-05-03 16:24:01
|
Author: sagamusix Date: Sat May 3 18:23:32 2025 New Revision: 23147 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=23147 Log: Merged revision(s) 23146 from trunk/OpenMPT: [Fix] Quick Channel Settings: Avoid setting keyboard focus to disabled input item for MOD/S3M files (https://bugs.openmpt.org/view.php?id=1880). [Fix] Quick Channel Settings: Accessible dialog title was not updated when navigating to another channel (https://bugs.openmpt.org/view.php?id=1880). ........ Modified: branches/OpenMPT-1.32/ (props changed) branches/OpenMPT-1.32/mptrack/DialogBase.cpp branches/OpenMPT-1.32/mptrack/DialogBase.h branches/OpenMPT-1.32/mptrack/PatternEditorDialogs.cpp Modified: branches/OpenMPT-1.32/mptrack/DialogBase.cpp ============================================================================== --- branches/OpenMPT-1.32/mptrack/DialogBase.cpp Fri May 2 17:11:09 2025 (r23146) +++ branches/OpenMPT-1.32/mptrack/DialogBase.cpp Sat May 3 18:23:32 2025 (r23147) @@ -63,6 +63,21 @@ } +void DialogBase::SetFocusToFirstControl() +{ + CWnd *child = GetWindow(GW_CHILD); + while(child) + { + if((child->GetStyle() & WS_TABSTOP) && child->IsWindowEnabled()) + { + child->SetFocus(); + return; + } + child = child->GetNextWindow(); + } +} + + LRESULT DialogBase::OnDPIChanged(WPARAM, LPARAM) { // We may receive a first WM_DPICHANGED before OnInitDialog() even runs. We don't want to tell our dialogs about a DPI "change" that early. Modified: branches/OpenMPT-1.32/mptrack/DialogBase.h ============================================================================== --- branches/OpenMPT-1.32/mptrack/DialogBase.h Fri May 2 17:11:09 2025 (r23146) +++ branches/OpenMPT-1.32/mptrack/DialogBase.h Sat May 3 18:23:32 2025 (r23147) @@ -28,6 +28,8 @@ int GetDPI() const { return m_dpi; } + void SetFocusToFirstControl(); + protected: virtual void OnDPIChanged() {} void UpdateDPI(); Modified: branches/OpenMPT-1.32/mptrack/PatternEditorDialogs.cpp ============================================================================== --- branches/OpenMPT-1.32/mptrack/PatternEditorDialogs.cpp Fri May 2 17:11:09 2025 (r23146) +++ branches/OpenMPT-1.32/mptrack/PatternEditorDialogs.cpp Sat May 3 18:23:32 2025 (r23147) @@ -1346,8 +1346,6 @@ m_panSlider.SetRange(0, 64); m_panSlider.SetTicFreq(8); m_panSpin.SetRange(0, 256); - - m_nameEdit.SetFocus(); } m_document = modDoc; m_channel = chn; @@ -1363,8 +1361,6 @@ Clamp(static_cast<int>(position.y) - rect.Height() / 2, 0, static_cast<int>(screenRect.bottom) - rect.Height())); MoveWindow(rect); - SetWindowText(MPT_TFORMAT("Settings for Channel {}")(chn + 1).c_str()); - UpdateDisplay(); const BOOL enablePan = (m_document->GetModType() & (MOD_TYPE_XM | MOD_TYPE_MOD)) ? FALSE : TRUE; @@ -1384,6 +1380,7 @@ // Channel name m_nameEdit.EnableWindow((m_document->GetModType() & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_XM)) ? TRUE : FALSE); + SetFocusToFirstControl(); ShowWindow(SW_SHOW); m_visible = true; } @@ -1391,6 +1388,8 @@ void QuickChannelProperties::UpdateDisplay() { + SetWindowText(MPT_TFORMAT("Settings for Channel {}")(m_channel + 1).c_str()); + // Set up channel properties m_visible = false; const ModChannelSettings &settings = m_document->GetSoundFile().ChnSettings[m_channel]; |