1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 14:02:57 +02:00

Show friendly names of commands in message boxes...

... With spaces in the English; maybe later they will localize
This commit is contained in:
Paul Licameli
2018-03-07 23:42:57 -05:00
parent 9298ac575d
commit 77f720b0c8
5 changed files with 69 additions and 33 deletions

View File

@@ -39,21 +39,29 @@ OldStyleCommandPointer BatchEvalCommandType::Create(std::unique_ptr<CommandOutpu
bool BatchEvalCommand::Apply(const CommandContext & context)
{
// Uh oh, I need to build a catalog, expensively
// Maybe it can be built in one long-lived place and shared among command
// objects instead?
MacroCommandsCatalog catalog(&context.project);
wxString macroName = GetString(wxT("MacroName"));
if (macroName != wxT(""))
{
MacroCommands batch;
batch.ReadMacro(macroName);
return batch.ApplyMacro();
return batch.ApplyMacro(catalog);
}
wxString cmdName = GetString(wxT("CommandName"));
wxString cmdParams = GetString(wxT("ParamString"));
auto iter = catalog.ByCommandId(cmdName);
const wxString &friendly = (iter == catalog.end())
? cmdName // Expose internal name to user, in default of a better one!
: iter->friendly;
// Create a Batch that will have just one command in it...
MacroCommands Batch;
bool bResult = Batch.ApplyCommand(cmdName, cmdParams, &context);
bool bResult = Batch.ApplyCommand(friendly, cmdName, cmdParams, &context);
// Relay messages, if any.
wxString Message = Batch.GetMessage();
if( !Message.IsEmpty() )