From 5fd6965925b8ff3ed20de8b4163fc0263d422e5f Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sun, 10 Mar 2019 22:05:37 -0400 Subject: [PATCH] Use type aliases CommandID, CommandIDs... ... for identifiers of menu commands and macros, and for vectors thereof --- include/audacity/Types.h | 3 ++ src/AdornedRulerPanel.cpp | 2 +- src/BatchCommandDialog.cpp | 6 +-- src/BatchCommandDialog.h | 6 +-- src/BatchCommands.cpp | 38 ++++++++++-------- src/BatchCommands.h | 25 ++++++------ src/BatchProcessDialog.cpp | 8 ++-- src/BatchProcessDialog.h | 6 +-- src/Internat.h | 10 +++-- src/Menus.cpp | 2 +- src/commands/CommandContext.h | 3 +- src/commands/CommandManager.cpp | 52 ++++++++++++------------ src/commands/CommandManager.h | 57 ++++++++++++++------------- src/commands/GetInfoCommand.cpp | 2 +- src/commands/ScreenshotCommand.cpp | 2 +- src/effects/EffectManager.cpp | 4 +- src/effects/EffectManager.h | 4 +- src/menus/PluginMenus.cpp | 6 +-- src/prefs/KeyConfigPrefs.cpp | 10 ++--- src/prefs/KeyConfigPrefs.h | 10 ++--- src/toolbars/ControlToolBar.cpp | 2 +- src/toolbars/EditToolBar.cpp | 2 +- src/toolbars/ScrubbingToolBar.cpp | 2 +- src/toolbars/ToolsToolBar.cpp | 2 +- src/toolbars/TranscriptionToolBar.cpp | 4 +- src/tracks/ui/Scrubbing.cpp | 2 +- src/widgets/KeyView.cpp | 20 +++++----- src/widgets/KeyView.h | 13 +++--- 28 files changed, 159 insertions(+), 144 deletions(-) diff --git a/include/audacity/Types.h b/include/audacity/Types.h index e21056060..456853126 100644 --- a/include/audacity/Types.h +++ b/include/audacity/Types.h @@ -76,6 +76,9 @@ using FileExtensions = wxArrayStringEx; using FilePath = wxString; using FilePaths = wxArrayStringEx; +using CommandID = wxString; +using CommandIDs = std::vector< CommandID >; + // ---------------------------------------------------------------------------- // A native 64-bit integer...used when referring to any number of samples // ---------------------------------------------------------------------------- diff --git a/src/AdornedRulerPanel.cpp b/src/AdornedRulerPanel.cpp index 9eeecf4bc..faffa3301 100644 --- a/src/AdornedRulerPanel.cpp +++ b/src/AdornedRulerPanel.cpp @@ -1637,7 +1637,7 @@ void AdornedRulerPanel::DrawBothOverlays() void AdornedRulerPanel::UpdateButtonStates() { auto common = [this] - (AButton &button, const wxString &commandName, const wxString &label) { + (AButton &button, const CommandID &commandName, const wxString &label) { TranslatedInternalString command{ commandName, label }; ToolBar::SetButtonToolTip( button, &command, 1u ); button.SetLabel(button.GetToolTipText()); diff --git a/src/BatchCommandDialog.cpp b/src/BatchCommandDialog.cpp index c6ccb89d6..d9fd0ceb4 100644 --- a/src/BatchCommandDialog.cpp +++ b/src/BatchCommandDialog.cpp @@ -198,7 +198,7 @@ void MacroCommandDialog::OnItemSelected(wxListEvent &event) void MacroCommandDialog::OnEditParams(wxCommandEvent & WXUNUSED(event)) { - wxString command = mInternalCommandName; + auto command = mInternalCommandName; wxString params = mParameters->GetValue(); params = MacroCommands::PromptForParamsFor(command, params, this).Trim(); @@ -209,7 +209,7 @@ void MacroCommandDialog::OnEditParams(wxCommandEvent & WXUNUSED(event)) void MacroCommandDialog::OnUsePreset(wxCommandEvent & WXUNUSED(event)) { - wxString command = mInternalCommandName; + auto command = mInternalCommandName; wxString params = mParameters->GetValue(); wxString preset = MacroCommands::PromptForPresetFor(command, params, this).Trim(); @@ -218,7 +218,7 @@ void MacroCommandDialog::OnUsePreset(wxCommandEvent & WXUNUSED(event)) mParameters->Refresh(); } -void MacroCommandDialog::SetCommandAndParams(const wxString &Command, const wxString &Params) +void MacroCommandDialog::SetCommandAndParams(const CommandID &Command, const wxString &Params) { auto iter = mCatalog.ByCommandId( Command ); diff --git a/src/BatchCommandDialog.h b/src/BatchCommandDialog.h index 815e77259..a35232526 100644 --- a/src/BatchCommandDialog.h +++ b/src/BatchCommandDialog.h @@ -42,9 +42,9 @@ class MacroCommandDialog final : public wxDialogWrapper { public: // constructors and destructors MacroCommandDialog(wxWindow *parent, wxWindowID id); - void SetCommandAndParams(const wxString &Command, const wxString &Params); + void SetCommandAndParams(const CommandID &Command, const wxString &Params); public: - wxString mSelectedCommand; + CommandID mSelectedCommand; wxString mSelectedParameters; private: void Populate(); @@ -69,7 +69,7 @@ class MacroCommandDialog final : public wxDialogWrapper { wxTextCtrl * mParameters; wxTextCtrl * mDetails; - wxString mInternalCommandName; + CommandID mInternalCommandName; const MacroCommandsCatalog mCatalog; diff --git a/src/BatchCommands.cpp b/src/BatchCommands.cpp index 4808792f4..f77aa9b4f 100644 --- a/src/BatchCommands.cpp +++ b/src/BatchCommands.cpp @@ -58,7 +58,7 @@ enum eCommandType { CtEffect, CtMenu, CtSpecial }; // TIDY-ME: Not currently translated, // but there are issues to address if we do. // CLEANSPEECH remnant -static const std::pair SpecialCommands[] = { +static const std::pair SpecialCommands[] = { // Use translations of the first members, some other day. // For 2.2.2 we'll get them into the catalog at least. @@ -140,7 +140,7 @@ void MacroCommands::RestoreMacro(const wxString & name) } } -wxString MacroCommands::GetCommand(int index) +CommandID MacroCommands::GetCommand(int index) { if (index < 0 || index >= (int)mCommandMacro.size()) { return wxT(""); @@ -320,7 +320,7 @@ MacroCommandsCatalog::MacroCommandsCatalog( const AudacityProject *project ) auto mManager = project->GetCommandManager(); wxArrayString mLabels; - wxArrayString mNames; + CommandIDs mNames; std::vector vHasDialog; mLabels.clear(); mNames.clear(); @@ -401,7 +401,7 @@ auto MacroCommandsCatalog::ByFriendlyName( const wxString &friendlyName ) const } // linear search -auto MacroCommandsCatalog::ByCommandId( const wxString &commandId ) const +auto MacroCommandsCatalog::ByCommandId( const CommandID &commandId ) const -> Entries::const_iterator { // Maybe this too should have a uniqueness check? @@ -412,9 +412,10 @@ auto MacroCommandsCatalog::ByCommandId( const wxString &commandId ) const -wxString MacroCommands::GetCurrentParamsFor(const wxString & command) +wxString MacroCommands::GetCurrentParamsFor(const CommandID & command) { - const PluginID & ID = EffectManager::Get().GetEffectByIdentifier(command); + const PluginID & ID = + EffectManager::Get().GetEffectByIdentifier(command); if (ID.empty()) { return wxEmptyString; // effect not found. @@ -423,9 +424,10 @@ wxString MacroCommands::GetCurrentParamsFor(const wxString & command) return EffectManager::Get().GetEffectParameters(ID); } -wxString MacroCommands::PromptForParamsFor(const wxString & command, const wxString & params, wxWindow *parent) +wxString MacroCommands::PromptForParamsFor(const CommandID & command, const wxString & params, wxWindow *parent) { - const PluginID & ID = EffectManager::Get().GetEffectByIdentifier(command); + const PluginID & ID = + EffectManager::Get().GetEffectByIdentifier(command); if (ID.empty()) { return wxEmptyString; // effect not found @@ -446,9 +448,10 @@ wxString MacroCommands::PromptForParamsFor(const wxString & command, const wxStr return res; } -wxString MacroCommands::PromptForPresetFor(const wxString & command, const wxString & params, wxWindow *parent) +wxString MacroCommands::PromptForPresetFor(const CommandID & command, const wxString & params, wxWindow *parent) { - const PluginID & ID = EffectManager::Get().GetEffectByIdentifier(command); + const PluginID & ID = + EffectManager::Get().GetEffectByIdentifier(command); if (ID.empty()) { return wxEmptyString; // effect not found. @@ -606,7 +609,7 @@ bool MacroCommands::WriteMp3File( const wxString & Name, int bitrate ) // CLEANSPEECH remnant bool MacroCommands::ApplySpecialCommand( int WXUNUSED(iCommand), const wxString &friendlyCommand, - const wxString & command, const wxString & params) + const CommandID & command, const wxString & params) { if (ReportAndSkip(friendlyCommand, params)) return true; @@ -701,7 +704,7 @@ bool MacroCommands::ApplySpecialCommand( bool MacroCommands::ApplyEffectCommand( const PluginID & ID, const wxString &friendlyCommand, - const wxString & command, const wxString & params, + const CommandID & command, const wxString & params, const CommandContext & Context) { static_cast(command);//compiler food. @@ -749,7 +752,7 @@ bool MacroCommands::ApplyEffectCommand( } bool MacroCommands::ApplyCommand( const wxString &friendlyCommand, - const wxString & command, const wxString & params, + const CommandID & command, const wxString & params, CommandContext const * pContext) { @@ -763,7 +766,8 @@ bool MacroCommands::ApplyCommand( const wxString &friendlyCommand, // end CLEANSPEECH remnant // Test for an effect. - const PluginID & ID = EffectManager::Get().GetEffectByIdentifier( command ); + const PluginID & ID = + EffectManager::Get().GetEffectByIdentifier( command ); if (!ID.empty()) { if( pContext ) @@ -798,7 +802,7 @@ bool MacroCommands::ApplyCommand( const wxString &friendlyCommand, } bool MacroCommands::ApplyCommandInBatchMode( const wxString &friendlyCommand, - const wxString & command, const wxString ¶ms, + const CommandID & command, const wxString ¶ms, CommandContext const * pContext) { AudacityProject *project = GetActiveProject(); @@ -894,12 +898,12 @@ void MacroCommands::AbortBatch() mAbort = true; } -void MacroCommands::AddToMacro(const wxString &command, int before) +void MacroCommands::AddToMacro(const CommandID &command, int before) { AddToMacro(command, GetCurrentParamsFor(command), before); } -void MacroCommands::AddToMacro(const wxString &command, const wxString ¶ms, int before) +void MacroCommands::AddToMacro(const CommandID &command, const wxString ¶ms, int before) { if (before == -1) { before = (int)mCommandMacro.size(); diff --git a/src/BatchCommands.h b/src/BatchCommands.h index 7d48e235a..7b02779e1 100644 --- a/src/BatchCommands.h +++ b/src/BatchCommands.h @@ -36,7 +36,7 @@ public: // binary search Entries::const_iterator ByFriendlyName( const wxString &friendlyName ) const; // linear search - Entries::const_iterator ByCommandId( const wxString &commandId ) const; + Entries::const_iterator ByCommandId( const CommandID &commandId ) const; // Lookup by position as sorted by friendly name const Entry &operator[] ( size_t index ) const { return mCommands[index]; } @@ -58,17 +58,17 @@ class MacroCommands final { bool ApplyMacro( const MacroCommandsCatalog &catalog, const wxString & filename = {}); bool ApplyCommand( const wxString &friendlyCommand, - const wxString & command, const wxString & params, + const CommandID & command, const wxString & params, CommandContext const * pContext=NULL ); bool ApplyCommandInBatchMode( const wxString &friendlyCommand, - const wxString & command, const wxString ¶ms, + const CommandID & command, const wxString ¶ms, CommandContext const * pContext = NULL); bool ApplySpecialCommand( int iCommand, const wxString &friendlyCommand, - const wxString & command, const wxString & params); + const CommandID & command, const wxString & params); bool ApplyEffectCommand( const PluginID & ID, const wxString &friendlyCommand, - const wxString & command, + const CommandID & command, const wxString & params, const CommandContext & Context); bool ReportAndSkip( const wxString & friendlyCommand, const wxString & params ); void AbortBatch(); @@ -85,9 +85,9 @@ class MacroCommands final { static wxArrayString GetNames(); static wxArrayStringEx GetNamesOfDefaultMacros(); - static wxString GetCurrentParamsFor(const wxString & command); - static wxString PromptForParamsFor(const wxString & command, const wxString & params, wxWindow *parent); - static wxString PromptForPresetFor(const wxString & command, const wxString & params, wxWindow *parent); + static wxString GetCurrentParamsFor(const CommandID & command); + static wxString PromptForParamsFor(const CommandID & command, const wxString & params, wxWindow *parent); + static wxString PromptForPresetFor(const CommandID & command, const wxString & params, wxWindow *parent); // These commands do depend on the command list. void ResetMacro(); @@ -99,10 +99,11 @@ class MacroCommands final { bool DeleteMacro(const wxString & name); bool RenameMacro(const wxString & oldmacro, const wxString & newmacro); - void AddToMacro(const wxString & command, int before = -1); - void AddToMacro(const wxString & command, const wxString & params, int before = -1); + void AddToMacro(const CommandID & command, int before = -1); + void AddToMacro(const CommandID & command, const wxString & params, int before = -1); + void DeleteFromMacro(int index); - wxString GetCommand(int index); + CommandID GetCommand(int index); wxString GetParams(int index); int GetCount(); wxString GetMessage(){ return mMessage;}; @@ -113,7 +114,7 @@ class MacroCommands final { void Split(const wxString & str, wxString & command, wxString & param); wxString Join(const wxString & command, const wxString & param); - wxArrayString mCommandMacro; + CommandIDs mCommandMacro; wxArrayString mParamsMacro; bool mAbort; wxString mMessage; diff --git a/src/BatchProcessDialog.cpp b/src/BatchProcessDialog.cpp index 9697372a4..850536e86 100644 --- a/src/BatchProcessDialog.cpp +++ b/src/BatchProcessDialog.cpp @@ -221,7 +221,7 @@ void ApplyMacroDialog::OnApplyToProject(wxCommandEvent & WXUNUSED(event)) ApplyMacroToProject( item ); } -wxString ApplyMacroDialog::MacroIdOfName( const wxString & MacroName ) +CommandID ApplyMacroDialog::MacroIdOfName( const wxString & MacroName ) { wxString Temp = MacroName; Temp.Replace(" ",""); @@ -231,7 +231,7 @@ wxString ApplyMacroDialog::MacroIdOfName( const wxString & MacroName ) // Apply macro, given its ID. // Does nothing if not found, rather than returning an error. -void ApplyMacroDialog::ApplyMacroToProject( const wxString & MacroID, bool bHasGui ) +void ApplyMacroDialog::ApplyMacroToProject( const CommandID & MacroID, bool bHasGui ) { for( int i=0;iGetItemCount();i++){ wxString name = mMacros->GetItemText(i); @@ -728,7 +728,7 @@ void MacrosWindow::PopulateList() } /// Add one item into mList -void MacrosWindow::AddItem(const wxString &Action, const wxString &Params) +void MacrosWindow::AddItem(const CommandID &Action, const wxString &Params) { auto entry = mCatalog.ByCommandId(Action); auto friendlyName = entry != mCatalog.end() @@ -1099,7 +1099,7 @@ void MacrosWindow::OnEditCommandParams(wxCommandEvent & WXUNUSED(event)) } // Just edit the parameters, and not the command. - wxString command = mMacroCommands.GetCommand(item); + auto command = mMacroCommands.GetCommand(item); wxString params = mMacroCommands.GetParams(item); params = MacroCommands::PromptForParamsFor(command, params, this).Trim(); diff --git a/src/BatchProcessDialog.h b/src/BatchProcessDialog.h index 2936c609a..234cbe020 100644 --- a/src/BatchProcessDialog.h +++ b/src/BatchProcessDialog.h @@ -56,9 +56,9 @@ class ApplyMacroDialog : public wxDialogWrapper { virtual wxString GetHelpPageName() {return "Apply_Macro";}; void PopulateMacros(); - static wxString MacroIdOfName( const wxString & MacroName ); + static CommandID MacroIdOfName( const wxString & MacroName ); void ApplyMacroToProject( int iMacro, bool bHasGui=true ); - void ApplyMacroToProject( const wxString & MacroID, bool bHasGui=true ); + void ApplyMacroToProject( const CommandID & MacroID, bool bHasGui=true ); // These will be reused in the derived class... @@ -99,7 +99,7 @@ private: : "Apply_Macro";}; void PopulateList(); - void AddItem(const wxString &command, wxString const ¶ms); + void AddItem(const CommandID &command, wxString const ¶ms); bool ChangeOK(); void UpdateMenus(); diff --git a/src/Internat.h b/src/Internat.h index 16eb74c5e..92e960995 100644 --- a/src/Internat.h +++ b/src/Internat.h @@ -195,7 +195,9 @@ class TranslatedInternalString { public: - TranslatedInternalString() = default; + using ID = CommandID; + + TranslatedInternalString() = default; // One-argument constructor from a msgid explicit TranslatedInternalString( const wxString &internal ) @@ -203,12 +205,12 @@ public: {} // Two-argument version, when translated does not derive from internal - TranslatedInternalString( const wxString &internal, + TranslatedInternalString( const ID &internal, const wxString &translated ) : mInternal{ internal }, mTranslated{ translated } {} - const wxString &Internal() const { return mInternal; } + const ID &Internal() const { return mInternal; } const wxString Translated() const { wxString Temp = mTranslated; @@ -217,7 +219,7 @@ public: } private: - wxString mInternal; + ID mInternal; wxString mTranslated; }; diff --git a/src/Menus.cpp b/src/Menus.cpp index d6e0a58e0..59689aa1f 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -114,7 +114,7 @@ ConditionalGroupItem::~ConditionalGroupItem() {} SeparatorItem::~SeparatorItem() {} -CommandItem::CommandItem(const wxString &name_, +CommandItem::CommandItem(const CommandID &name_, const wxString &label_in_, bool hasDialog_, CommandHandlerFinder finder_, diff --git a/src/commands/CommandContext.h b/src/commands/CommandContext.h index 5b1f9039e..a59b26fd7 100644 --- a/src/commands/CommandContext.h +++ b/src/commands/CommandContext.h @@ -13,6 +13,7 @@ #include #include +#include "audacity/Types.h" #include "../MemoryX.h" #include "Command.h" @@ -20,7 +21,7 @@ class AudacityProject; class AudacityApp; class wxEvent; class CommandOutputTargets; -using CommandParameter = wxString; +using CommandParameter = CommandID; class AUDACITY_DLL_API CommandContext { public: diff --git a/src/commands/CommandManager.cpp b/src/commands/CommandManager.cpp index 0070f3f06..3028db787 100644 --- a/src/commands/CommandManager.cpp +++ b/src/commands/CommandManager.cpp @@ -746,7 +746,7 @@ void CommandManager::ClearCurrentMenu() -void CommandManager::AddItem(const wxChar *name, +void CommandManager::AddItem(const CommandID &name, const wxChar *label_in, bool hasDialog, CommandHandlerFinder finder, @@ -767,7 +767,7 @@ void CommandManager::AddItem(const wxChar *name, if (mask == NoFlagsSpecified) mask = flags; - wxString cookedParameter; + CommandParameter cookedParameter; const auto ¶meter = options.parameter; if( parameter.empty() ) cookedParameter = name; @@ -804,7 +804,7 @@ void CommandManager::AddItem(const wxChar *name, /// with its position in the list as the index number. /// When you call Enable on this command name, it will enable or disable /// all of the items at once. -void CommandManager::AddItemList(const wxString & name, +void CommandManager::AddItemList(const CommandID & name, const ComponentInterfaceSymbol items[], size_t nItems, CommandHandlerFinder finder, @@ -835,7 +835,7 @@ void CommandManager::AddItemList(const wxString & name, /// /// Add a command that doesn't appear in a menu. When the key is pressed, the /// given function pointer will be called (via the CommandManagerListener) -void CommandManager::AddCommand(const wxChar *name, +void CommandManager::AddCommand(const CommandID &name, const wxChar *label, CommandHandlerFinder finder, CommandFunctorPointer callback, @@ -844,7 +844,7 @@ void CommandManager::AddCommand(const wxChar *name, AddCommand(name, label, finder, callback, wxT(""), flags); } -void CommandManager::AddCommand(const wxChar *name, +void CommandManager::AddCommand(const CommandID &name, const wxChar *label_in, CommandHandlerFinder finder, CommandFunctorPointer callback, @@ -858,7 +858,7 @@ void CommandManager::AddCommand(const wxChar *name, SetCommandFlags(name, flags, flags); } -void CommandManager::AddGlobalCommand(const wxChar *name, +void CommandManager::AddGlobalCommand(const CommandID &name, const wxChar *label_in, bool hasDialog, CommandHandlerFinder finder, @@ -898,14 +898,14 @@ int CommandManager::NextIdentifier(int ID) ///WARNING: Does this conflict with the identifiers set for controls/windows? ///If it does, a workaround may be to keep controls below wxID_LOWEST ///and keep menus above wxID_HIGHEST -CommandListEntry *CommandManager::NewIdentifier(const wxString & name, +CommandListEntry *CommandManager::NewIdentifier(const CommandID & name, const wxString & label, const wxString & longLabel, bool hasDialog, wxMenu *menu, CommandHandlerFinder finder, CommandFunctorPointer callback, - const wxString &nameSuffix, + const CommandID &nameSuffix, int index, int count, bool bIsEffect) @@ -925,7 +925,7 @@ CommandListEntry *CommandManager::NewIdentifier(const wxString & name, {}); } -CommandListEntry *CommandManager::NewIdentifier(const wxString & nameIn, +CommandListEntry *CommandManager::NewIdentifier(const CommandID & nameIn, const wxString & label, const wxString & longLabel, bool hasDialog, @@ -933,14 +933,14 @@ CommandListEntry *CommandManager::NewIdentifier(const wxString & nameIn, wxMenu *menu, CommandHandlerFinder finder, CommandFunctorPointer callback, - const wxString &nameSuffix, + const CommandID &nameSuffix, int index, int count, bool bIsEffect, const CommandParameter ¶meter) { const bool multi = !nameSuffix.empty(); - wxString name = nameIn; + auto name = nameIn; // If we have the identifier already, reuse it. CommandListEntry *prev = mCommandNameHash[name]; @@ -1201,7 +1201,7 @@ void CommandManager::EnableUsingFlags(CommandFlag flags, CommandMask mask) } } -bool CommandManager::GetEnabled(const wxString &name) +bool CommandManager::GetEnabled(const CommandID &name) { CommandListEntry *entry = mCommandNameHash[name]; if (!entry || !entry->menu) { @@ -1212,7 +1212,7 @@ bool CommandManager::GetEnabled(const wxString &name) return entry->enabled; } -void CommandManager::Check(const wxString &name, bool checked) +void CommandManager::Check(const CommandID &name, bool checked) { CommandListEntry *entry = mCommandNameHash[name]; if (!entry || !entry->menu || entry->isOccult) { @@ -1231,7 +1231,7 @@ void CommandManager::Modify(const wxString &name, const wxString &newLabel) } } -void CommandManager::SetKeyFromName(const wxString &name, +void CommandManager::SetKeyFromName(const CommandID &name, const NormalizedKeyString &key) { CommandListEntry *entry = mCommandNameHash[name]; @@ -1330,7 +1330,7 @@ wxString CommandManager::DescribeCommandsAndShortcuts // was missing from the translation file and defaulted to the English. auto piece = wxString::Format(wxT("%s%s"), mark, pair.Translated()); - wxString name{ pair.Internal() }; + auto name = pair.Internal(); if (!name.empty()) { auto keyStr = GetKeyFromName(name); if (!keyStr.empty()){ @@ -1541,7 +1541,7 @@ bool CommandManager::HandleMenuID(int id, CommandFlag flags, CommandMask mask) /// HandleTextualCommand() allows us a limitted version of script/batch /// behavior, since we can get from a string command name to the actual /// code to run. -bool CommandManager::HandleTextualCommand(const wxString & Str, const CommandContext & context, CommandFlag flags, CommandMask mask) +bool CommandManager::HandleTextualCommand(const CommandID & Str, const CommandContext & context, CommandFlag flags, CommandMask mask) { if( Str.empty() ) return false; @@ -1622,7 +1622,7 @@ void CommandManager::GetCategories(wxArrayString &cats) #endif } -void CommandManager::GetAllCommandNames(wxArrayString &names, +void CommandManager::GetAllCommandNames(CommandIDs &names, bool includeMultis) const { for(const auto &entry : mCommandList) { @@ -1655,7 +1655,7 @@ void CommandManager::GetAllCommandLabels(wxArrayString &names, } void CommandManager::GetAllCommandData( - wxArrayString &names, + CommandIDs &names, std::vector &keys, std::vector &default_keys, wxArrayString &labels, @@ -1695,15 +1695,15 @@ void CommandManager::GetAllCommandData( } } -wxString CommandManager::GetNameFromID(int id) +CommandID CommandManager::GetNameFromID(int id) { CommandListEntry *entry = mCommandIDHash[id]; if (!entry) - return wxT(""); + return {}; return entry->name; } -wxString CommandManager::GetLabelFromName(const wxString &name) +wxString CommandManager::GetLabelFromName(const CommandID &name) { CommandListEntry *entry = mCommandNameHash[name]; if (!entry) @@ -1712,7 +1712,7 @@ wxString CommandManager::GetLabelFromName(const wxString &name) return entry->longLabel; } -wxString CommandManager::GetPrefixedLabelFromName(const wxString &name) +wxString CommandManager::GetPrefixedLabelFromName(const CommandID &name) { CommandListEntry *entry = mCommandNameHash[name]; if (!entry) @@ -1729,7 +1729,7 @@ wxString CommandManager::GetPrefixedLabelFromName(const wxString &name) #endif } -wxString CommandManager::GetCategoryFromName(const wxString &name) +wxString CommandManager::GetCategoryFromName(const CommandID &name) { CommandListEntry *entry = mCommandNameHash[name]; if (!entry) @@ -1738,7 +1738,7 @@ wxString CommandManager::GetCategoryFromName(const wxString &name) return entry->labelTop; } -NormalizedKeyString CommandManager::GetKeyFromName(const wxString &name) const +NormalizedKeyString CommandManager::GetKeyFromName(const CommandID &name) const { CommandListEntry *entry = // May create a NULL entry @@ -1749,7 +1749,7 @@ NormalizedKeyString CommandManager::GetKeyFromName(const wxString &name) const return entry->key; } -NormalizedKeyString CommandManager::GetDefaultKeyFromName(const wxString &name) +NormalizedKeyString CommandManager::GetDefaultKeyFromName(const CommandID &name) { CommandListEntry *entry = mCommandNameHash[name]; if (!entry) @@ -1847,7 +1847,7 @@ void CommandManager::EndOccultCommands() mTempMenuBar.reset(); } -void CommandManager::SetCommandFlags(const wxString &name, +void CommandManager::SetCommandFlags(const CommandID &name, CommandFlag flags, CommandMask mask) { CommandListEntry *entry = mCommandNameHash[name]; diff --git a/src/commands/CommandManager.h b/src/commands/CommandManager.h index bedf1c4eb..3b6d7b72b 100644 --- a/src/commands/CommandManager.h +++ b/src/commands/CommandManager.h @@ -14,6 +14,8 @@ #include "../Experimental.h" +#include "audacity/Types.h" + #include "CommandFunctors.h" #include "CommandFlag.h" @@ -30,8 +32,8 @@ #include -using CommandParameter = wxString; class TranslatedInternalString; +using CommandParameter = CommandID; struct MenuBarListEntry { @@ -62,7 +64,7 @@ struct SubMenuListEntry struct CommandListEntry { int id; - wxString name; + CommandID name; wxString longLabel; NormalizedKeyString key; NormalizedKeyString defaultKey; @@ -178,7 +180,7 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler bool global{ false }; }; - void AddItemList(const wxString & name, + void AddItemList(const CommandID & name, const ComponentInterfaceSymbol items[], size_t nItems, CommandHandlerFinder finder, @@ -186,7 +188,7 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler CommandFlag flags, bool bIsEffect = false); - void AddItem(const wxChar *name, + void AddItem(const CommandID &name, const wxChar *label_in, bool hasDialog, CommandHandlerFinder finder, @@ -198,13 +200,13 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler // A command doesn't actually appear in a menu but might have a // keyboard shortcut. - void AddCommand(const wxChar *name, + void AddCommand(const CommandID &name, const wxChar *label, CommandHandlerFinder finder, CommandFunctorPointer callback, CommandFlag flags); - void AddCommand(const wxChar *name, + void AddCommand(const CommandID &name, const wxChar *label, CommandHandlerFinder finder, CommandFunctorPointer callback, @@ -216,7 +218,7 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler void EndOccultCommands(); - void SetCommandFlags(const wxString &name, CommandFlag flags, CommandMask mask); + void SetCommandFlags(const CommandID &name, CommandFlag flags, CommandMask mask); // // Modifying menus @@ -224,7 +226,7 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler void EnableUsingFlags(CommandFlag flags, CommandMask mask); void Enable(const wxString &name, bool enabled); - void Check(const wxString &name, bool checked); + void Check(const CommandID &name, bool checked); void Modify(const wxString &name, const wxString &newLabel); // You may either called SetCurrentMenu later followed by ClearCurrentMenu, @@ -236,7 +238,7 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler // Modifying accelerators // - void SetKeyFromName(const wxString &name, const NormalizedKeyString &key); + void SetKeyFromName(const CommandID &name, const NormalizedKeyString &key); void SetKeyFromIndex(int i, const NormalizedKeyString &key); // @@ -247,19 +249,19 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler // Lyrics and MixerTrackCluster classes use it. bool FilterKeyEvent(AudacityProject *project, const wxKeyEvent & evt, bool permit = false); bool HandleMenuID(int id, CommandFlag flags, CommandMask mask); - bool HandleTextualCommand(const wxString & Str, const CommandContext & context, CommandFlag flags, CommandMask mask); + bool HandleTextualCommand(const CommandID & Str, const CommandContext & context, CommandFlag flags, CommandMask mask); // // Accessing // void GetCategories(wxArrayString &cats); - void GetAllCommandNames(wxArrayString &names, bool includeMultis) const; + void GetAllCommandNames(CommandIDs &names, bool includeMultis) const; void GetAllCommandLabels( wxArrayString &labels, std::vector &vHasDialog, bool includeMultis) const; void GetAllCommandData( - wxArrayString &names, + CommandIDs &names, std::vector &keys, std::vector &default_keys, wxArrayString &labels, wxArrayString &categories, @@ -268,14 +270,15 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler #endif bool includeMultis); - wxString GetNameFromID( int id ); - wxString GetLabelFromName(const wxString &name); - wxString GetPrefixedLabelFromName(const wxString &name); - wxString GetCategoryFromName(const wxString &name); - NormalizedKeyString GetKeyFromName(const wxString &name) const; - NormalizedKeyString GetDefaultKeyFromName(const wxString &name); + CommandID GetNameFromID( int id ); - bool GetEnabled(const wxString &name); + wxString GetLabelFromName(const CommandID &name); + wxString GetPrefixedLabelFromName(const CommandID &name); + wxString GetCategoryFromName(const CommandID &name); + NormalizedKeyString GetKeyFromName(const CommandID &name) const; + NormalizedKeyString GetDefaultKeyFromName(const CommandID &name); + + bool GetEnabled(const CommandID &name); #if defined(__WXDEBUG__) void CheckDups(); @@ -307,18 +310,18 @@ private: // int NextIdentifier(int ID); - CommandListEntry *NewIdentifier(const wxString & name, + CommandListEntry *NewIdentifier(const CommandID & name, const wxString & label, const wxString & longLabel, bool hasDialog, wxMenu *menu, CommandHandlerFinder finder, CommandFunctorPointer callback, - const wxString &nameSuffix, + const CommandID &nameSuffix, int index, int count, bool bIsEffect); - CommandListEntry *NewIdentifier(const wxString & name, + CommandListEntry *NewIdentifier(const CommandID & name, const wxString & label, const wxString & longLabel, bool hasDialog, @@ -326,13 +329,13 @@ private: wxMenu *menu, CommandHandlerFinder finder, CommandFunctorPointer callback, - const wxString &nameSuffix, + const CommandID &nameSuffix, int index, int count, bool bIsEffect, const CommandParameter ¶meter); - void AddGlobalCommand(const wxChar *name, + void AddGlobalCommand(const CommandID &name, const wxChar *label, bool hasDialog, CommandHandlerFinder finder, @@ -508,7 +511,7 @@ namespace MenuTable { }; struct CommandItem final : BaseItem { - CommandItem(const wxString &name_, + CommandItem(const CommandID &name_, const wxString &label_in_, bool hasDialog_, CommandHandlerFinder finder_, @@ -517,7 +520,7 @@ namespace MenuTable { const CommandManager::Options &options_); ~CommandItem() override; - const wxString name; + const CommandID name; const wxString label_in; bool hasDialog; CommandHandlerFinder finder; @@ -608,7 +611,7 @@ namespace MenuTable { { return std::make_unique(); } inline std::unique_ptr Command( - const wxString &name, const wxString &label_in, bool hasDialog, + const CommandID &name, const wxString &label_in, bool hasDialog, CommandHandlerFinder finder, CommandFunctorPointer callback, CommandFlag flags, const CommandManager::Options &options = {}) { diff --git a/src/commands/GetInfoCommand.cpp b/src/commands/GetInfoCommand.cpp index ed6a58e44..f6170554c 100644 --- a/src/commands/GetInfoCommand.cpp +++ b/src/commands/GetInfoCommand.cpp @@ -411,7 +411,7 @@ void GetInfoCommand::ExploreMenu( const CommandContext &context, wxMenu * pMenu, wxMenuItem * item; wxString Label; wxString Accel; - wxString Name; + CommandID Name; for (size_t lndx = 0; lndx < lcnt; lndx++) { item = list.Item(lndx)->GetData(); diff --git a/src/commands/ScreenshotCommand.cpp b/src/commands/ScreenshotCommand.cpp index 5e9f0e63c..384f665c3 100644 --- a/src/commands/ScreenshotCommand.cpp +++ b/src/commands/ScreenshotCommand.cpp @@ -442,7 +442,7 @@ void ScreenshotCommand::CapturePreferences( SetIdleHandler( IdleHandler ); gPrefs->Write(wxT("/Prefs/PrefsCategory"), (long)i); gPrefs->Flush(); - wxString Command = "Preferences"; + CommandID Command{ wxT("Preferences") }; const CommandContext projectContext( *pProject ); if( !pMan->HandleTextualCommand( Command, projectContext, AlwaysEnabledFlag, AlwaysEnabledFlag ) ) { diff --git a/src/effects/EffectManager.cpp b/src/effects/EffectManager.cpp index 6d32a64af..72171dfc8 100644 --- a/src/effects/EffectManager.cpp +++ b/src/effects/EffectManager.cpp @@ -168,7 +168,7 @@ wxString EffectManager::GetVendorName(const PluginID & ID) return {}; } -wxString EffectManager::GetCommandIdentifier(const PluginID & ID) +CommandID EffectManager::GetCommandIdentifier(const PluginID & ID) { wxString name = PluginManager::Get().GetSymbol(ID).Internal(); @@ -944,7 +944,7 @@ AudacityCommand *EffectManager::GetAudacityCommand(const PluginID & ID) } -const PluginID & EffectManager::GetEffectByIdentifier(const wxString & strTarget) +const PluginID & EffectManager::GetEffectByIdentifier(const CommandID & strTarget) { static PluginID empty; if (strTarget.empty()) // set GetCommandIdentifier to wxT("") to not show an effect in Batch mode diff --git a/src/effects/EffectManager.h b/src/effects/EffectManager.h index cbd6c3766..5aa3d27a4 100644 --- a/src/effects/EffectManager.h +++ b/src/effects/EffectManager.h @@ -91,7 +91,7 @@ public: // Renamed from 'Effect' to 'Command' prior to moving out of this class. ComponentInterfaceSymbol GetCommandSymbol(const PluginID & ID); wxString GetCommandName(const PluginID & ID); // translated - wxString GetCommandIdentifier(const PluginID & ID); + CommandID GetCommandIdentifier(const PluginID & ID); wxString GetCommandDescription(const PluginID & ID); wxString GetCommandUrl(const PluginID & ID); wxString GetCommandTip(const PluginID & ID); @@ -148,7 +148,7 @@ public: void ShowRack(); #endif - const PluginID & GetEffectByIdentifier(const wxString & strTarget); + const PluginID & GetEffectByIdentifier(const CommandID & strTarget); private: /** Return an effect by its ID. */ diff --git a/src/menus/PluginMenus.cpp b/src/menus/PluginMenus.cpp index 6d849d0d5..5784cc7cc 100644 --- a/src/menus/PluginMenus.cpp +++ b/src/menus/PluginMenus.cpp @@ -660,7 +660,7 @@ void OnApplyMacroDirectly(const CommandContext &context ) //wxLogDebug( "Macro was: %s", context.parameter); ApplyMacroDialog dlg( &project ); - wxString Name = context.parameter; + const auto &Name = context.parameter; // We used numbers previously, but macros could get renumbered, making // macros containing macros unpredictable. @@ -760,7 +760,7 @@ void AddEffectMenuItemGroup( if (i + 1 < namesCnt && names[i] == names[i + 1]) { // collect a sub-menu for like-named items - const wxString name = names[i]; + const auto name = names[i]; BaseItemPtrs temp2; while (i < namesCnt && names[i] == name) { @@ -828,7 +828,7 @@ MenuTable::BaseItemPtrs PopulateMacrosMenu( CommandFlag flags ) int i; for (i = 0; i < (int)names.size(); i++) { - wxString MacroID = ApplyMacroDialog::MacroIdOfName( names[i] ); + auto MacroID = ApplyMacroDialog::MacroIdOfName( names[i] ); result.push_back( MenuTable::Command( MacroID, names[i], false, FN(OnApplyMacroDirectly), flags ) ); diff --git a/src/prefs/KeyConfigPrefs.cpp b/src/prefs/KeyConfigPrefs.cpp index 47f7ac179..2b4370d19 100644 --- a/src/prefs/KeyConfigPrefs.cpp +++ b/src/prefs/KeyConfigPrefs.cpp @@ -77,7 +77,7 @@ BEGIN_EVENT_TABLE(KeyConfigPrefs, PrefsPanel) END_EVENT_TABLE() KeyConfigPrefs::KeyConfigPrefs(wxWindow * parent, wxWindowID winid, - const wxString &name) + const CommandID &name) /* i18n-hint: as in computer keyboard (not musical!) */ : PrefsPanel(parent, winid, _("Keyboard")), mView(NULL), @@ -501,7 +501,7 @@ void KeyConfigPrefs::OnFilterChar(wxKeyEvent & e) // Given a hotkey combination, returns the name (description) of the // corresponding command, or the empty string if none is found. -wxString KeyConfigPrefs::NameFromKey(const NormalizedKeyString & key) +CommandID KeyConfigPrefs::NameFromKey(const NormalizedKeyString & key) { return mView->GetNameByKey(key); } @@ -510,7 +510,7 @@ wxString KeyConfigPrefs::NameFromKey(const NormalizedKeyString & key) // This is not yet a committed change, which will happen on a save. void KeyConfigPrefs::SetKeyForSelected(const NormalizedKeyString & key) { - wxString name = mView->GetName(mCommandSelected); + auto name = mView->GetName(mCommandSelected); if (!mView->CanSetKey(mCommandSelected)) { @@ -534,8 +534,8 @@ void KeyConfigPrefs::OnSet(wxCommandEvent & WXUNUSED(event)) } NormalizedKeyString key { mKey->GetValue() }; - wxString oldname = mView->GetNameByKey(key); - wxString newname = mView->GetName(mCommandSelected); + auto oldname = mView->GetNameByKey(key); + auto newname = mView->GetName(mCommandSelected); // Just ignore it if they are the same if (oldname == newname) { diff --git a/src/prefs/KeyConfigPrefs.h b/src/prefs/KeyConfigPrefs.h index 3eaa00374..a7ad5fb8e 100644 --- a/src/prefs/KeyConfigPrefs.h +++ b/src/prefs/KeyConfigPrefs.h @@ -36,7 +36,7 @@ struct NormalizedKeyString; class KeyConfigPrefs final : public PrefsPanel { public: - KeyConfigPrefs(wxWindow * parent, wxWindowID winid, const wxString &name); + KeyConfigPrefs(wxWindow * parent, wxWindowID winid, const CommandID &name); bool Commit() override; void Cancel() override; wxString HelpPageName() override; @@ -46,7 +46,7 @@ private: void Populate(); void RefreshBindings(bool bSort); void FilterKeys( std::vector & arr ); - wxString NameFromKey(const NormalizedKeyString & key); + CommandID NameFromKey(const NormalizedKeyString & key); void SetKeyForSelected(const NormalizedKeyString & key); void OnViewBy(wxCommandEvent & e); @@ -84,7 +84,7 @@ private: CommandManager *mManager; int mCommandSelected; - wxArrayString mNames; + CommandIDs mNames; std::vector mDefaultKeys; // The full set. std::vector mStandardDefaultKeys; // The reduced set. std::vector mKeys; @@ -98,11 +98,11 @@ private: class KeyConfigPrefsFactory final : public PrefsPanelFactory { public: - KeyConfigPrefsFactory(const wxString &name = wxString{}) + KeyConfigPrefsFactory(const CommandID &name = {}) : mName{ name } {} PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override; private: - wxString mName; + CommandID mName; }; #endif diff --git a/src/toolbars/ControlToolBar.cpp b/src/toolbars/ControlToolBar.cpp index 7f637a2bb..f0fcb61ed 100644 --- a/src/toolbars/ControlToolBar.cpp +++ b/src/toolbars/ControlToolBar.cpp @@ -227,7 +227,7 @@ void ControlToolBar::RegenerateTooltips() for (long iWinID = ID_PLAY_BUTTON; iWinID < BUTTON_COUNT; iWinID++) { auto pCtrl = static_cast(this->FindWindow(iWinID)); - const wxChar *name = nullptr; + CommandID name; switch (iWinID) { case ID_PLAY_BUTTON: diff --git a/src/toolbars/EditToolBar.cpp b/src/toolbars/EditToolBar.cpp index ba4354e0f..e3bd55051 100644 --- a/src/toolbars/EditToolBar.cpp +++ b/src/toolbars/EditToolBar.cpp @@ -225,7 +225,7 @@ void EditToolBar::EnableDisableButtons() static const struct Entry { int tool; - wxString commandName; + CommandID commandName; wxString untranslatedLabel; } EditToolbarButtonList[] = { { ETBCutID, wxT("Cut"), XO("Cut") }, diff --git a/src/toolbars/ScrubbingToolBar.cpp b/src/toolbars/ScrubbingToolBar.cpp index 9242f2c0a..142f3adca 100644 --- a/src/toolbars/ScrubbingToolBar.cpp +++ b/src/toolbars/ScrubbingToolBar.cpp @@ -136,7 +136,7 @@ void ScrubbingToolBar::RegenerateTooltips() { #if wxUSE_TOOLTIPS auto fn = [&] - (AButton &button, const wxString &label, const wxString &cmd) + (AButton &button, const wxString &label, const CommandID &cmd) { TranslatedInternalString command{ cmd, label }; ToolBar::SetButtonToolTip( button, &command, 1u ); diff --git a/src/toolbars/ToolsToolBar.cpp b/src/toolbars/ToolsToolBar.cpp index 4c612e758..b0a0dfdc3 100644 --- a/src/toolbars/ToolsToolBar.cpp +++ b/src/toolbars/ToolsToolBar.cpp @@ -126,7 +126,7 @@ void ToolsToolBar::RegenerateTooltips() static const struct Entry { int tool; - wxString commandName; + CommandID commandName; wxString untranslatedLabel; } table[] = { { selectTool, wxT("SelectTool"), XO("Selection Tool") }, diff --git a/src/toolbars/TranscriptionToolBar.cpp b/src/toolbars/TranscriptionToolBar.cpp index ee40bc73a..c28c0e88e 100644 --- a/src/toolbars/TranscriptionToolBar.cpp +++ b/src/toolbars/TranscriptionToolBar.cpp @@ -303,9 +303,9 @@ void TranscriptionToolBar::RegenerateTooltips() static const struct Entry { int tool; - wxString commandName; + CommandID commandName; wxString untranslatedLabel; - wxString commandName2; + CommandID commandName2; wxString untranslatedLabel2; } table[] = { { TTB_PlaySpeed, wxT("PlayAtSpeed"), XO("Play-at-Speed"), diff --git a/src/tracks/ui/Scrubbing.cpp b/src/tracks/ui/Scrubbing.cpp index 6b839b292..3adadb9fb 100644 --- a/src/tracks/ui/Scrubbing.cpp +++ b/src/tracks/ui/Scrubbing.cpp @@ -232,7 +232,7 @@ Scrubber::~Scrubber() namespace { const struct MenuItem { - wxString name; + CommandID name; wxString label; wxString status; CommandFlag flags; diff --git a/src/widgets/KeyView.cpp b/src/widgets/KeyView.cpp index 157a45f1b..edc820f7a 100644 --- a/src/widgets/KeyView.cpp +++ b/src/widgets/KeyView.cpp @@ -142,7 +142,7 @@ KeyView::GetFullLabel(int index) const // Returns the index for the given name // int -KeyView::GetIndexByName(const wxString & name) const +KeyView::GetIndexByName(const CommandID & name) const { int cnt = (int) mNodes.size(); @@ -161,14 +161,14 @@ KeyView::GetIndexByName(const wxString & name) const // // Returns the command manager name for the given index // -wxString +CommandID KeyView::GetName(int index) const { // Make sure index is valid if (index < 0 || index >= (int) mNodes.size()) { wxASSERT(false); - return wxEmptyString; + return {}; } return mNodes[index].name; @@ -177,7 +177,7 @@ KeyView::GetName(int index) const // // Returns the command manager index for the given key combination // -wxString +CommandID KeyView::GetNameByKey(const NormalizedKeyString & key) const { int cnt = (int) mNodes.size(); @@ -191,7 +191,7 @@ KeyView::GetNameByKey(const NormalizedKeyString & key) const } } - return wxEmptyString; + return {}; } // @@ -292,7 +292,7 @@ KeyView::SetKey(int index, const NormalizedKeyString & key) // Sets the key for the given name // bool -KeyView::SetKeyByName(const wxString & name, const NormalizedKeyString & key) +KeyView::SetKeyByName(const CommandID & name, const NormalizedKeyString & key) { int index = GetIndexByName(name); @@ -518,7 +518,7 @@ KeyView::UpdateHScroll() // Process a NEW set of bindings // void -KeyView::RefreshBindings(const wxArrayString & names, +KeyView::RefreshBindings(const CommandIDs & names, const wxArrayString & categories, const wxArrayString & prefixes, const wxArrayString & labels, @@ -545,7 +545,7 @@ KeyView::RefreshBindings(const wxArrayString & names, int cnt = (int) names.size(); for (int i = 0; i < cnt; i++) { - wxString name = names[i]; + auto name = names[i]; int x, y; // Remove any menu code from the category and prefix @@ -587,7 +587,7 @@ KeyView::RefreshBindings(const wxArrayString & names, KeyNode node; // Fill in the node info - node.name = wxEmptyString; // don't associate branches with a command + node.name = CommandID{}; // don't associate branches with a command node.category = cat; node.prefix = pfx; node.label = cat; @@ -627,7 +627,7 @@ KeyView::RefreshBindings(const wxArrayString & names, KeyNode node; // Fill in the node info - node.name = wxEmptyString; // don't associate branches with a command + node.name = CommandID{}; // don't associate branches with a command node.category = cat; node.prefix = pfx; node.label = pfx; diff --git a/src/widgets/KeyView.h b/src/widgets/KeyView.h index bfc934871..9d3660df3 100644 --- a/src/widgets/KeyView.h +++ b/src/widgets/KeyView.h @@ -10,6 +10,7 @@ #define __AUDACITY_WIDGETS_KEYVIEW__ #include "../Audacity.h" +#include "audacity/Types.h" #include #include @@ -40,7 +41,7 @@ public: //KeyNode &operator = ( KeyNode && ) = default; public: - wxString name; + CommandID name; wxString category; wxString prefix; wxString label; @@ -83,7 +84,7 @@ public: virtual ~KeyView(); wxString GetName() const; // Gets the control name from the base class - void RefreshBindings(const wxArrayString & names, + void RefreshBindings(const CommandIDs & names, const wxArrayString & categories, const wxArrayString & prefixes, const wxArrayString & labels, @@ -95,15 +96,15 @@ public: wxString GetLabel(int index) const; wxString GetFullLabel(int index) const; - int GetIndexByName(const wxString & name) const; - wxString GetName(int index) const; - wxString GetNameByKey(const NormalizedKeyString & key) const; + int GetIndexByName(const CommandID & name) const; + CommandID GetName(int index) const; + CommandID GetNameByKey(const NormalizedKeyString & key) const; int GetIndexByKey(const NormalizedKeyString & key) const; NormalizedKeyString GetKey(int index) const; bool CanSetKey(int index) const; bool SetKey(int index, const NormalizedKeyString & key); - bool SetKeyByName(const wxString & name, const NormalizedKeyString & key); + bool SetKeyByName(const CommandID & name, const NormalizedKeyString & key); void SetView(ViewByType type);