mirror of
https://github.com/cookiengineer/audacity
synced 2026-03-06 14:35:32 +01:00
Reduce number of shortcuts provided by default.
The full list of shortcuts, the maxList, is still available, and can be set in KeyboardPreferences.
This commit is contained in:
@@ -305,6 +305,7 @@ void KeyConfigPrefs::RefreshBindings(bool bSort)
|
||||
mNames.Clear();
|
||||
mKeys.Clear();
|
||||
mDefaultKeys.Clear();
|
||||
mStandardDefaultKeys.Clear();
|
||||
mManager->GetAllCommandData(
|
||||
mNames,
|
||||
mKeys,
|
||||
@@ -314,6 +315,9 @@ void KeyConfigPrefs::RefreshBindings(bool bSort)
|
||||
Prefixes,
|
||||
true); // True to include effects (list items), false otherwise.
|
||||
|
||||
mStandardDefaultKeys = mDefaultKeys;
|
||||
FilterKeys( mStandardDefaultKeys );
|
||||
|
||||
mView->RefreshBindings(mNames,
|
||||
Categories,
|
||||
Prefixes,
|
||||
@@ -401,10 +405,8 @@ void KeyConfigPrefs::OnDefaults(wxCommandEvent & event)
|
||||
PopupMenu(&Menu);//, wxPoint(0, 0));
|
||||
}
|
||||
|
||||
void KeyConfigPrefs::OnImportDefaults(wxCommandEvent & event)
|
||||
void KeyConfigPrefs::FilterKeys( wxArrayString & arr )
|
||||
{
|
||||
int id = event.GetId();
|
||||
mNewKeys = mDefaultKeys;
|
||||
wxSortedArrayString MaxListOnly;
|
||||
|
||||
// These short cuts are for the max list only....
|
||||
@@ -460,14 +462,21 @@ void KeyConfigPrefs::OnImportDefaults(wxCommandEvent & event)
|
||||
MaxListOnly.Add( "Alt+F6" );
|
||||
|
||||
MaxListOnly.Sort();
|
||||
// Remove items that are in MaxList.
|
||||
for (size_t i = 0; i < arr.GetCount(); i++) {
|
||||
if( MaxListOnly.Index( arr[i] ) != wxNOT_FOUND )
|
||||
arr[i]= wxT("");
|
||||
}
|
||||
}
|
||||
|
||||
void KeyConfigPrefs::OnImportDefaults(wxCommandEvent & event)
|
||||
{
|
||||
mNewKeys = mDefaultKeys;
|
||||
if( event.GetId() == 0 )
|
||||
FilterKeys( mNewKeys );
|
||||
|
||||
for (size_t i = 0; i < mNewKeys.GetCount(); 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 |= ( MaxListOnly.Index( mNewKeys[i] ) != wxNOT_FOUND );
|
||||
mManager->SetKeyFromIndex(i, bDeleteBinding ? "" : mNewKeys[i]);
|
||||
mManager->SetKeyFromIndex(i, mNewKeys[i]);
|
||||
}
|
||||
|
||||
RefreshBindings(true);
|
||||
@@ -703,7 +712,7 @@ bool KeyConfigPrefs::Commit()
|
||||
PopulateOrExchange(S);
|
||||
|
||||
for (size_t i = 0; i < mNames.GetCount(); i++) {
|
||||
wxString dkey = KeyStringNormalize(mDefaultKeys[i]);
|
||||
wxString dkey = KeyStringNormalize(mStandardDefaultKeys[i]);
|
||||
wxString name = wxT("/NewKeys/") + mNames[i];
|
||||
wxString key = KeyStringNormalize(mNewKeys[i]);
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ private:
|
||||
void Populate();
|
||||
void PopulateOrExchange(ShuttleGui & S);
|
||||
void RefreshBindings(bool bSort);
|
||||
void FilterKeys( wxArrayString & arr );
|
||||
wxString NameFromKey(const wxString & key);
|
||||
void SetKeyForSelected(const wxString & key);
|
||||
|
||||
@@ -86,7 +87,8 @@ private:
|
||||
int mCommandSelected;
|
||||
|
||||
wxArrayString mNames;
|
||||
wxArrayString mDefaultKeys;
|
||||
wxArrayString mDefaultKeys; // The full set.
|
||||
wxArrayString mStandardDefaultKeys; // The reduced set.
|
||||
wxArrayString mKeys;
|
||||
wxArrayString mNewKeys; // Used for work in progress.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user