mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-02 17:09:26 +02:00
Pass friendly macro command names as TranslatableString
This commit is contained in:
parent
dc39f22442
commit
2214b5ff3b
@ -615,7 +615,7 @@ bool MacroCommands::WriteMp3File( const wxString & Name, int bitrate )
|
|||||||
// ======= IMPORTANT ========
|
// ======= IMPORTANT ========
|
||||||
// CLEANSPEECH remnant
|
// CLEANSPEECH remnant
|
||||||
bool MacroCommands::ApplySpecialCommand(
|
bool MacroCommands::ApplySpecialCommand(
|
||||||
int WXUNUSED(iCommand), const wxString &friendlyCommand,
|
int WXUNUSED(iCommand), const TranslatableString &friendlyCommand,
|
||||||
const CommandID & command, const wxString & params)
|
const CommandID & command, const wxString & params)
|
||||||
{
|
{
|
||||||
if (ReportAndSkip(friendlyCommand, params))
|
if (ReportAndSkip(friendlyCommand, params))
|
||||||
@ -756,7 +756,7 @@ bool MacroCommands::DoAudacityCommand(
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool MacroCommands::ApplyEffectCommand(
|
bool MacroCommands::ApplyEffectCommand(
|
||||||
const PluginID & ID, const wxString &friendlyCommand,
|
const PluginID & ID, const TranslatableString &friendlyCommand,
|
||||||
const CommandID & command, const wxString & params,
|
const CommandID & command, const wxString & params,
|
||||||
const CommandContext & Context)
|
const CommandContext & Context)
|
||||||
{
|
{
|
||||||
@ -839,7 +839,7 @@ bool MacroCommands::HandleTextualCommand( CommandManager &commandManager,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroCommands::ApplyCommand( const wxString &friendlyCommand,
|
bool MacroCommands::ApplyCommand( const TranslatableString &friendlyCommand,
|
||||||
const CommandID & command, const wxString & params,
|
const CommandID & command, const wxString & params,
|
||||||
CommandContext const * pContext)
|
CommandContext const * pContext)
|
||||||
{
|
{
|
||||||
@ -872,7 +872,7 @@ bool MacroCommands::ApplyCommand( const wxString &friendlyCommand,
|
|||||||
manager, command, *pContext, AlwaysEnabledFlag, true ) )
|
manager, command, *pContext, AlwaysEnabledFlag, true ) )
|
||||||
return true;
|
return true;
|
||||||
pContext->Status( wxString::Format(
|
pContext->Status( wxString::Format(
|
||||||
_("Your batch command of %s was not recognized."), friendlyCommand ));
|
_("Your batch command of %s was not recognized."), friendlyCommand.Translation() ));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -890,7 +890,8 @@ bool MacroCommands::ApplyCommand( const wxString &friendlyCommand,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroCommands::ApplyCommandInBatchMode( const wxString &friendlyCommand,
|
bool MacroCommands::ApplyCommandInBatchMode(
|
||||||
|
const TranslatableString &friendlyCommand,
|
||||||
const CommandID & command, const wxString ¶ms,
|
const CommandID & command, const wxString ¶ms,
|
||||||
CommandContext const * pContext)
|
CommandContext const * pContext)
|
||||||
{
|
{
|
||||||
@ -946,12 +947,12 @@ bool MacroCommands::ApplyMacro(
|
|||||||
for (; i < mCommandMacro.size(); i++) {
|
for (; i < mCommandMacro.size(); i++) {
|
||||||
const auto &command = mCommandMacro[i];
|
const auto &command = mCommandMacro[i];
|
||||||
auto iter = catalog.ByCommandId(command);
|
auto iter = catalog.ByCommandId(command);
|
||||||
auto friendly = (iter == catalog.end())
|
const auto friendly = (iter == catalog.end())
|
||||||
?
|
?
|
||||||
// uh oh, using GET to expose an internal name to the user!
|
// uh oh, using GET to expose an internal name to the user!
|
||||||
// in default of any better friendly name
|
// in default of any better friendly name
|
||||||
command.GET()
|
Verbatim( command.GET() )
|
||||||
: iter->name.StrippedTranslation();
|
: iter->name.Msgid().Stripped();
|
||||||
if (!ApplyCommandInBatchMode(friendly, command, mParamsMacro[i]) || mAbort)
|
if (!ApplyCommandInBatchMode(friendly, command, mParamsMacro[i]) || mAbort)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1025,7 +1026,7 @@ void MacroCommands::ResetMacro()
|
|||||||
// ReportAndSkip() is a diagnostic function that avoids actually
|
// ReportAndSkip() is a diagnostic function that avoids actually
|
||||||
// applying the requested effect if in batch-debug mode.
|
// applying the requested effect if in batch-debug mode.
|
||||||
bool MacroCommands::ReportAndSkip(
|
bool MacroCommands::ReportAndSkip(
|
||||||
const wxString & friendlyCommand, const wxString & params)
|
const TranslatableString & friendlyCommand, const wxString & params)
|
||||||
{
|
{
|
||||||
int bDebug;
|
int bDebug;
|
||||||
gPrefs->Read(wxT("/Batch/Debug"), &bDebug, false);
|
gPrefs->Read(wxT("/Batch/Debug"), &bDebug, false);
|
||||||
|
@ -66,20 +66,20 @@ class MacroCommands final {
|
|||||||
static bool HandleTextualCommand( CommandManager &commandManager,
|
static bool HandleTextualCommand( CommandManager &commandManager,
|
||||||
const CommandID & Str,
|
const CommandID & Str,
|
||||||
const CommandContext & context, CommandFlag flags, bool alwaysEnabled);
|
const CommandContext & context, CommandFlag flags, bool alwaysEnabled);
|
||||||
bool ApplyCommand( const wxString &friendlyCommand,
|
bool ApplyCommand( const TranslatableString &friendlyCommand,
|
||||||
const CommandID & command, const wxString & params,
|
const CommandID & command, const wxString & params,
|
||||||
CommandContext const * pContext=NULL );
|
CommandContext const * pContext=NULL );
|
||||||
bool ApplyCommandInBatchMode( const wxString &friendlyCommand,
|
bool ApplyCommandInBatchMode( const TranslatableString &friendlyCommand,
|
||||||
const CommandID & command, const wxString ¶ms,
|
const CommandID & command, const wxString ¶ms,
|
||||||
CommandContext const * pContext = NULL);
|
CommandContext const * pContext = NULL);
|
||||||
bool ApplySpecialCommand(
|
bool ApplySpecialCommand(
|
||||||
int iCommand, const wxString &friendlyCommand,
|
int iCommand, const TranslatableString &friendlyCommand,
|
||||||
const CommandID & command, const wxString & params);
|
const CommandID & command, const wxString & params);
|
||||||
bool ApplyEffectCommand(
|
bool ApplyEffectCommand(
|
||||||
const PluginID & ID, const wxString &friendlyCommand,
|
const PluginID & ID, const TranslatableString &friendlyCommand,
|
||||||
const CommandID & command,
|
const CommandID & command,
|
||||||
const wxString & params, const CommandContext & Context);
|
const wxString & params, const CommandContext & Context);
|
||||||
bool ReportAndSkip( const wxString & friendlyCommand, const wxString & params );
|
bool ReportAndSkip( const TranslatableString & friendlyCommand, const wxString & params );
|
||||||
void AbortBatch();
|
void AbortBatch();
|
||||||
|
|
||||||
// Utility functions for the special commands.
|
// Utility functions for the special commands.
|
||||||
|
@ -59,12 +59,12 @@ bool BatchEvalCommand::Apply(const CommandContext & context)
|
|||||||
return batch.ApplyMacro(catalog);
|
return batch.ApplyMacro(catalog);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString cmdName = GetString(wxT("CommandName"));
|
auto cmdName = GetString(wxT("CommandName"));
|
||||||
wxString cmdParams = GetString(wxT("ParamString"));
|
wxString cmdParams = GetString(wxT("ParamString"));
|
||||||
auto iter = catalog.ByCommandId(cmdName);
|
auto iter = catalog.ByCommandId(cmdName);
|
||||||
const wxString &friendly = (iter == catalog.end())
|
const auto friendly = (iter == catalog.end())
|
||||||
? cmdName // Expose internal name to user, in default of a better one!
|
? Verbatim( cmdName ) // Expose internal name to user, in default of a better one!
|
||||||
: iter->name.StrippedTranslation();
|
: iter->name.Msgid().Stripped();
|
||||||
|
|
||||||
// Create a Batch that will have just one command in it...
|
// Create a Batch that will have just one command in it...
|
||||||
MacroCommands Batch;
|
MacroCommands Batch;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user