void WIDGET_HOTKEY_LIST::changeHotkey( CHANGED_HOTKEY& aHotkey, long aKey ) { // See if this key code is handled in hotkeys names list bool exists; KeyNameFromKeyCode( aKey, &exists ); auto& curr_hk = aHotkey.GetCurrentValue(); if( exists && curr_hk.m_KeyCode != aKey ) { const auto& tag = aHotkey.GetSectionTag(); bool can_update = ResolveKeyConflicts( aKey, tag ); if( can_update ) { curr_hk.m_KeyCode = aKey; } } }
void WIDGET_HOTKEY_LIST::EditItem( wxTreeListItem aItem ) { WIDGET_HOTKEY_CLIENT_DATA* hkdata = GetHKClientData( aItem ); if( !hkdata ) { // Activated item was not a hotkey row return; } wxString name = GetItemText( aItem, 0 ); wxString current_key = GetItemText( aItem, 1 ); wxKeyEvent key_event = HK_PROMPT_DIALOG::PromptForKey( GetParent(), name, current_key ); long key = MapKeypressToKeycode( key_event ); if( hkdata && key ) { // See if this key code is handled in hotkeys names list bool exists; KeyNameFromKeyCode( key, &exists ); if( exists && hkdata->GetHotkey().m_KeyCode != key ) { wxString tag = hkdata->GetSectionTag(); bool canUpdate = ResolveKeyConflicts( key, tag ); if( canUpdate ) { hkdata->GetHotkey().m_KeyCode = key; } } UpdateFromClientData(); // Trigger a resize in case column widths have changed wxSizeEvent dummy_evt; OnSize( dummy_evt ); } }