1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-02 00:29:41 +02:00

Change CommandManager terminology: "Numeric id" not just "Id" ...

... because I will use CommandId for string identifiers instead, and those
are the really persistent identification
This commit is contained in:
Paul Licameli 2019-02-27 12:57:21 -05:00
parent 11c8377460
commit 19bf094893
3 changed files with 12 additions and 10 deletions

View File

@ -577,7 +577,7 @@ void CommandManager::PurgeData()
mCommandNameHash.clear();
mCommandKeyHash.clear();
mCommandIDHash.clear();
mCommandNumericIDHash.clear();
mCurrentMenuName = COMMAND;
mCurrentID = 17000;
@ -1064,7 +1064,7 @@ CommandListEntry *CommandManager::NewIdentifier(const CommandID & nameIn,
// New variable
CommandListEntry *entry = &*mCommandList.back();
mCommandIDHash[entry->id] = entry;
mCommandNumericIDHash[entry->id] = entry;
#if defined(__WXDEBUG__)
prev = mCommandNameHash[entry->name];
@ -1192,7 +1192,7 @@ void CommandManager::Enable(CommandListEntry *entry, bool enabled)
// This menu item is not necessarily in the same menu, because
// multi-items can be spread across multiple sub menus
CommandListEntry *multiEntry = mCommandIDHash[ID];
CommandListEntry *multiEntry = mCommandNumericIDHash[ID];
if (multiEntry) {
wxMenuItem *item = multiEntry->menu->FindItem(ID);
@ -1554,7 +1554,7 @@ bool CommandManager::HandleCommandEntry(const CommandListEntry * entry,
#include "../prefs/KeyConfigPrefs.h"
bool CommandManager::HandleMenuID(int id, CommandFlag flags, CommandMask mask)
{
CommandListEntry *entry = mCommandIDHash[id];
CommandListEntry *entry = mCommandNumericIDHash[id];
#ifdef EXPERIMENTAL_EASY_CHANGE_KEY_BINDINGS
if (::wxGetMouseState().ShiftDown()) {
@ -1728,9 +1728,9 @@ void CommandManager::GetAllCommandData(
}
}
CommandID CommandManager::GetNameFromID(int id)
CommandID CommandManager::GetNameFromNumericID(int id)
{
CommandListEntry *entry = mCommandIDHash[id];
CommandListEntry *entry = mCommandNumericIDHash[id];
if (!entry)
return {};
return entry->name;

View File

@ -95,7 +95,7 @@ using CommandList = std::vector<std::unique_ptr<CommandListEntry>>;
using CommandKeyHash = std::unordered_map<NormalizedKeyString, CommandListEntry*>;
using CommandNameHash = std::unordered_map<wxString, CommandListEntry*>;
using CommandIDHash = std::unordered_map<int, CommandListEntry*>;
using CommandNumericIDHash = std::unordered_map<int, CommandListEntry*>;
class AudacityProject;
class CommandContext;
@ -253,7 +253,9 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
#endif
bool includeMultis);
CommandID GetNameFromID( int id );
// Each command is assigned a numerical ID for use in wxMenu and wxEvent,
// which need not be the same across platforms or sessions
CommandID GetNameFromNumericID( int id );
wxString GetLabelFromName(const CommandID &name);
wxString GetPrefixedLabelFromName(const CommandID &name);
@ -372,7 +374,7 @@ private:
CommandList mCommandList;
CommandNameHash mCommandNameHash;
CommandKeyHash mCommandKeyHash;
CommandIDHash mCommandIDHash;
CommandNumericIDHash mCommandNumericIDHash;
int mCurrentID;
int mXMLKeysRead;

View File

@ -653,7 +653,7 @@ void GetInfoCommand::ExploreMenu( const CommandContext &context, wxMenu * pMenu,
for (size_t lndx = 0; lndx < lcnt; lndx++) {
item = list.Item(lndx)->GetData();
Label = item->GetItemLabelText();
Name = pMan->GetNameFromID( item->GetId() );
Name = pMan->GetNameFromNumericID( item->GetId() );
Accel = item->GetItemLabel();
if( Accel.Contains("\t") )
Accel = Accel.AfterLast('\t');