diff --git a/src/Menus.cpp b/src/Menus.cpp index fbe1a63e3..6661a315b 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -786,10 +786,9 @@ void AudacityProject::CreateMenusAndCommands() c->AddItem(wxT("Record"), _("&Record"), FN(OnRecord), wxT("R")); c->AddItem(wxT("TimerRecord"), _("&Timer Record..."), FN(OnTimerRecord), wxT("Shift+T")); c->AddItem(wxT("RecordBelow"), _("Record Below"), FN(OnRecordBelow), wxT("Shift+R")); - // I decided to duplicate this between play and record, rather than put it at the top level. - // However I must not set the short cut here, as setting it twice disables it! - // TODO: find a way that it is OK to have the same shortcut for a repeated function. - c->AddItem(wxT("Pause"), _("&Pause"), FN(OnPause));//, wxT("P")); + // JKC: I decided to duplicate this between play and record, rather than put it + // at the top level. AddItem can now cope with simple duplicated items. + c->AddItem(wxT("Pause"), _("&Pause"), FN(OnPause), wxT("P")); c->EndSubMenu(); // Scrubbing sub-menu diff --git a/src/commands/CommandManager.cpp b/src/commands/CommandManager.cpp index 902cc7fb3..152b18dc7 100644 --- a/src/commands/CommandManager.cpp +++ b/src/commands/CommandManager.cpp @@ -848,6 +848,14 @@ CommandListEntry *CommandManager::NewIdentifier(const wxString & name, int index, int count) { + // If we have the identifier already, reuse it. + CommandListEntry *prev = mCommandNameHash[name]; + if (!prev); + else if( prev->label != label ); + else if( multi ); + else + return prev; + { // Make a unique_ptr or shared_ptr as appropriate: auto entry = make_movable(); @@ -918,7 +926,7 @@ CommandListEntry *CommandManager::NewIdentifier(const wxString & name, mCommandIDHash[entry->id] = entry; #if defined(__WXDEBUG__) - CommandListEntry *prev = mCommandNameHash[entry->name]; + prev = mCommandNameHash[entry->name]; if (prev) { // Under Linux it looks as if we may ask for a newID for the same command // more than once. So it's only an error if two different commands