1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-15 17:11:20 +01:00

Define MacroCommandsCatalog to associate friendly and internal names...

... friendly names are still English only.  Not yet localized, but ought to be.
This commit is contained in:
Paul Licameli
2018-03-06 15:28:05 -05:00
parent 9d73effe09
commit ffadd64a56
8 changed files with 142 additions and 92 deletions

View File

@@ -525,6 +525,7 @@ enum {
/// Constructor
MacrosWindow::MacrosWindow(wxWindow * parent, bool bExpanded):
ApplyMacroDialog(parent, true)
, mCatalog( GetActiveProject() )
{
mbExpanded = bExpanded;
SetLabel(_("Manage Macros")); // Provide visual label
@@ -547,8 +548,6 @@ MacrosWindow::~MacrosWindow()
/// Creates the dialog and its contents.
void MacrosWindow::Populate()
{
mCommandNames = MacroCommands::GetAllCommands();
//------------------------- Main section --------------------
ShuttleGui S(this, eIsCreating);
PopulateOrExchange(S);
@@ -690,14 +689,13 @@ void MacrosWindow::PopulateList()
/// Add one item into mList
void MacrosWindow::AddItem(const wxString &Action, const wxString &Params)
{
// Translate internal command name to a friendly form
auto item = make_iterator_range(mCommandNames).index_if(
[&](const CommandName &name){ return Action == std::get<1>(name); }
);
auto friendlyName = item >= 0
? // wxGetTranslation
std::get<0>( mCommandNames[item] )
: Action;
auto entry = mCatalog.ByCommandId(Action);
auto friendlyName = entry != mCatalog.end()
? entry->friendly /* .Translation() */
:
// Expose an internal name to the user in default of any friendly name
// -- AVOID THIS!
Action;
int i = mList->GetItemCount();