Upgraders to 2.2.0 retain the full set of default shortcuts.

If they delete audacity.cfg they get the new smaller set of defaults.  Also if they explicitly ask for the standard set.
This commit is contained in:
James Crook 2017-06-30 21:38:20 +01:00
parent aa8be0c413
commit 46154d0dca
4 changed files with 20 additions and 2 deletions

View File

@ -294,6 +294,10 @@ void AudacityProject::CreateMenusAndCommands()
wxArrayString names;
wxArrayInt indices;
// The list of defaults to exclude depends on
// preference wxT("/GUI/Shortcuts/FullDefaults"), which may have changed.
c->SetMaxList();
{
auto menubar = c->AddMenuBar(wxT("appmenu"));
wxASSERT(menubar);

View File

@ -313,6 +313,13 @@ void InitPreferences()
gPrefs->Write(wxT("/GUI/ToolBars/Meter/Dock"), -1);
}
// Upgrading pre 2.2.0 configs we assume extended set of defaults.
if ((0<vMajor && vMajor < 2) ||
(vMajor == 2 && vMinor < 2))
{
gPrefs->Write(wxT("/GUI/Shortcuts/FullDefaults"),1);
}
// write out the version numbers to the prefs file for future checking
gPrefs->Write(wxT("/Version/Major"), AUDACITY_VERSION);
gPrefs->Write(wxT("/Version/Minor"), AUDACITY_RELEASE);

View File

@ -426,8 +426,6 @@ CommandManager::CommandManager():
{
mbSeparatorAllowed = false;
SetMaxList();
}
///
@ -452,6 +450,12 @@ void CommandManager::SetMaxList()
// shortcut is standard or full.
mMaxListOnly.Clear();
// if the full list, don't exclude any.
bool bFull = gPrefs->ReadBool(wxT("/GUI/Shortcuts/FullDefaults"),false);
if( bFull )
return;
// These short cuts are for the max list only....
//mMaxListOnly.Add( "Ctrl+I" );
mMaxListOnly.Add( "Ctrl+Alt+I" );

View File

@ -471,6 +471,9 @@ void KeyConfigPrefs::FilterKeys( wxArrayString & arr )
void KeyConfigPrefs::OnImportDefaults(wxCommandEvent & event)
{
gPrefs->DeleteEntry(wxT("/GUI/Shortcuts/FullDefaults"));
gPrefs->Flush();
mNewKeys = mDefaultKeys;
if( event.GetId() == 0 )
FilterKeys( mNewKeys );