1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-08 16:11:14 +02:00

Provide two choices for defaults in KeyPreferences

This is a step towards reducing the default list of shortcuts.
This commit is contained in:
James Crook 2017-05-27 20:14:56 +01:00
parent 389335d761
commit 216ead2214
2 changed files with 35 additions and 2 deletions

View File

@ -387,12 +387,44 @@ void KeyConfigPrefs::OnExport(wxCommandEvent & WXUNUSED(event))
} );
}
void KeyConfigPrefs::OnDefaults(wxCommandEvent & WXUNUSED(event))
// There currently is only one clickable AButton
// so we just do what it needs.
void KeyConfigPrefs::OnDefaults(wxCommandEvent & event)
{
wxMenu Menu;
Menu.Append( 0, _("Import Standard Defaults") );
Menu.Append( 1, _("Import Max Defaults") );
Menu.Bind( wxEVT_COMMAND_MENU_SELECTED, &KeyConfigPrefs::OnImportDefaults, this );
// Pop it up where the mouse is.
PopupMenu(&Menu);//, wxPoint(0, 0));
}
void KeyConfigPrefs::OnImportDefaults(wxCommandEvent & event)
{
int id = event.GetId();
mNewKeys = mDefaultKeys;
for (size_t i = 0; i < mNewKeys.GetCount(); i++) {
mManager->SetKeyFromIndex(i, mNewKeys[i]);
// Proof of concept for idea for freeing up some unwanted bindings.
// There will be neater code idioms we can use.
bool bDeleteBinding = false;
if( id == 0 ){
bDeleteBinding |= ( mNewKeys[i] == "A" );
bDeleteBinding |= ( mNewKeys[i] == "D" );
bDeleteBinding |= ( mNewKeys[i] == "Ctrl+Shift+A" );
bDeleteBinding |= ( mNewKeys[i] == "Alt+X" );
bDeleteBinding |= ( mNewKeys[i] == "Alt+K" );
bDeleteBinding |= ( mNewKeys[i] == "Alt+Shift+X" );
bDeleteBinding |= ( mNewKeys[i] == "Alt+Shift+K" );
bDeleteBinding |= ( mNewKeys[i] == "Alt+L" );
bDeleteBinding |= ( mNewKeys[i] == "Alt+Shift+C" );
bDeleteBinding |= ( mNewKeys[i] == "Alt+I" );
bDeleteBinding |= ( mNewKeys[i] == "Alt+J" );
bDeleteBinding |= ( mNewKeys[i] == "Alt+Shift+J" );
}
mManager->SetKeyFromIndex(i, bDeleteBinding ? "" : mNewKeys[i]);
}
RefreshBindings(true);

View File

@ -52,6 +52,7 @@ private:
void OnViewBy(wxCommandEvent & e);
void OnDefaults(wxCommandEvent & e);
void OnImportDefaults(wxCommandEvent & e);
void OnImport(wxCommandEvent & e);
void OnExport(wxCommandEvent & e);
void OnSet(wxCommandEvent & e);