Mark modified hotkeys in the hotkey editor

THis uses a simple " *" suffix, as the wxTreeListCtrl-derivative
widget doesn't allow easy access to things like font style.
This commit is contained in:
John Beard 2018-09-27 12:30:43 +01:00 committed by Wayne Stambaugh
parent 9f38b70491
commit 3283bd9fdc
2 changed files with 18 additions and 2 deletions

View File

@ -308,10 +308,17 @@ void WIDGET_HOTKEY_LIST::UpdateFromClientData()
if( hkdata )
{
const EDA_HOTKEY& hk = hkdata->GetChangedHotkey().GetCurrentValue();
const auto& changed_hk = hkdata->GetChangedHotkey();
const EDA_HOTKEY& hk = changed_hk.GetCurrentValue();
wxString key_text = KeyNameFromKeyCode( hk.m_KeyCode );
// mark unsaved changes
if( changed_hk.HasUnsavedChange() )
key_text += " *";
SetItemText( i, 0, wxGetTranslation( hk.m_InfoMsg ) );
SetItemText( i, 1, KeyNameFromKeyCode( hk.m_KeyCode ) );
SetItemText( i, 1, key_text);
}
}
}

View File

@ -71,6 +71,15 @@ public:
m_orig = m_changed;
}
/**
* @brief Return true if the hotkey doesn't match the original (i.e. it
* has been changed)
*/
bool HasUnsavedChange() const
{
return m_orig.m_KeyCode != m_changed.m_KeyCode;
}
const wxString& GetSectionTag() const
{
return m_tag;