From: <sv...@op...> - 2024-11-21 19:56:48
|
Author: sagamusix Date: Thu Nov 21 20:56:35 2024 New Revision: 22257 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22257 Log: [Fix] Key Config: When changing a shortcut via a search that had results in multiple contexts, a wrong context could be assigned to the shortcut. Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp ============================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp Thu Nov 21 14:34:01 2024 (r22256) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp Thu Nov 21 20:56:35 2024 (r22257) @@ -451,7 +451,7 @@ const bool hasKey = m_eFindHotKey.HasKey(); if(!hasKey) UpdateCategory(); - UpdateShortcutList(hasKey ? - 1: m_curCategory); + UpdateShortcutList(hasKey ? -1 : m_curCategory); m_lbnCommandKeys.SetFocus(); } @@ -896,7 +896,7 @@ if(m_bKeyUp.GetCheck() != BST_UNCHECKED) event |= kKeyEventUp; - KeyCombination kc((commandCategories[m_curCategory]).id, m_eCustHotKey.mod, m_eCustHotKey.code, event); + KeyCombination kc((commandCategories[GetCategoryFromCommandID(cmd)]).id, m_eCustHotKey.mod, m_eCustHotKey.code, event); //detect invalid input if(!kc.KeyCode()) { @@ -909,7 +909,7 @@ kc.EventType(kKeyEventDown); } - bool add = true; + bool add = true, updateAll = false; std::pair<CommandID, KeyCombination> conflictCmd; if(CCommandSet::MustBeModifierKey(cmd) && !kc.IsModifierCombination()) { @@ -923,6 +923,7 @@ if(delOld == cnfYes) { m_localCmdSet->Remove(conflictCmd.second, conflictCmd.first); + updateAll = true; } else if(delOld == cnfCancel) { // Cancel altogther; restore original choice @@ -943,7 +944,7 @@ //process valid input m_localCmdSet->Remove(m_curKeyChoice, cmd); UpdateWarning(m_localCmdSet->Add(kc, cmd, true, m_curKeyChoice), true); - ForceUpdateGUI(); + ForceUpdateGUI(updateAll); } } |