mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 08:09:32 +02:00
Fix displays of strings for macro dialogs...
... Internationalize some prompts; command names are not yet internationalized everywhere, but will display the "friendly" form with spaces when mentioned in message boxes
This commit is contained in:
commit
bf0c079f28
@ -62,6 +62,7 @@ MacroCommandDialog::MacroCommandDialog(wxWindow * parent, wxWindowID id):
|
|||||||
wxDialogWrapper(parent, id, _("Select Command"),
|
wxDialogWrapper(parent, id, _("Select Command"),
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxCAPTION | wxRESIZE_BORDER)
|
wxCAPTION | wxRESIZE_BORDER)
|
||||||
|
, mCatalog( GetActiveProject() )
|
||||||
{
|
{
|
||||||
SetLabel(_("Select Command")); // Provide visual label
|
SetLabel(_("Select Command")); // Provide visual label
|
||||||
SetName(_("Select Command")); // Provide audible label
|
SetName(_("Select Command")); // Provide audible label
|
||||||
@ -123,12 +124,11 @@ void MacroCommandDialog::PopulateOrExchange(ShuttleGui &S)
|
|||||||
|
|
||||||
void MacroCommandDialog::PopulateCommandList()
|
void MacroCommandDialog::PopulateCommandList()
|
||||||
{
|
{
|
||||||
mCommandNames = MacroCommands::GetAllCommands();
|
|
||||||
|
|
||||||
mChoices->DeleteAllItems();
|
mChoices->DeleteAllItems();
|
||||||
for (size_t ii = 0, size = mCommandNames.size(); ii < size; ++ii)
|
long ii = 0;
|
||||||
|
for ( const auto &entry : mCatalog )
|
||||||
// insert the user-facing string
|
// insert the user-facing string
|
||||||
mChoices->InsertItem( ii, std::get<0>( mCommandNames[ii] ) );
|
mChoices->InsertItem( ii++, entry.friendly /* .Translation() */ );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroCommandDialog::ValidateChoices()
|
void MacroCommandDialog::ValidateChoices()
|
||||||
@ -159,21 +159,21 @@ void MacroCommandDialog::OnHelp(wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
void MacroCommandDialog::OnItemSelected(wxListEvent &event)
|
void MacroCommandDialog::OnItemSelected(wxListEvent &event)
|
||||||
{
|
{
|
||||||
const auto &command = mCommandNames[ event.GetIndex() ];
|
const auto &command = mCatalog[ event.GetIndex() ];
|
||||||
|
|
||||||
EffectManager & em = EffectManager::Get();
|
EffectManager & em = EffectManager::Get();
|
||||||
PluginID ID = em.GetEffectByIdentifier( std::get<1>( command ));
|
PluginID ID = em.GetEffectByIdentifier( command.internal );
|
||||||
|
|
||||||
// If ID is empty, then the effect wasn't found, in which case, the user must have
|
// If ID is empty, then the effect wasn't found, in which case, the user must have
|
||||||
// selected one of the "special" commands.
|
// selected one of the "special" commands.
|
||||||
mEditParams->Enable(!ID.IsEmpty());
|
mEditParams->Enable(!ID.IsEmpty());
|
||||||
mUsePreset->Enable(em.HasPresets(ID));
|
mUsePreset->Enable(em.HasPresets(ID));
|
||||||
|
|
||||||
if (std::get<0>( command ) == mCommand->GetValue())
|
if ( command.friendly == mCommand->GetValue() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mCommand->SetValue(std::get<0> (command));
|
mCommand->SetValue(command.friendly);
|
||||||
mInternalCommandName = std::get<1>( command );
|
mInternalCommandName = command.internal;
|
||||||
|
|
||||||
wxString params = MacroCommands::GetCurrentParamsFor(mInternalCommandName);
|
wxString params = MacroCommands::GetCurrentParamsFor(mInternalCommandName);
|
||||||
if (params.IsEmpty())
|
if (params.IsEmpty())
|
||||||
@ -183,7 +183,7 @@ void MacroCommandDialog::OnItemSelected(wxListEvent &event)
|
|||||||
|
|
||||||
// Cryptic command and category.
|
// Cryptic command and category.
|
||||||
// Later we can put help information there, perhaps.
|
// Later we can put help information there, perhaps.
|
||||||
mDetails->SetValue( mInternalCommandName + "\r\n" + std::get<2>(command) );
|
mDetails->SetValue( mInternalCommandName + "\r\n" + command.category );
|
||||||
mParameters->SetValue(params);
|
mParameters->SetValue(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,19 +211,20 @@ void MacroCommandDialog::OnUsePreset(wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
void MacroCommandDialog::SetCommandAndParams(const wxString &Command, const wxString &Params)
|
void MacroCommandDialog::SetCommandAndParams(const wxString &Command, const wxString &Params)
|
||||||
{
|
{
|
||||||
auto item = make_iterator_range(mCommandNames).index_if(
|
auto iter = mCatalog.ByCommandId( Command );
|
||||||
[&](const CommandName &name){ return Command == std::get<1>( name); }
|
|
||||||
);
|
|
||||||
|
|
||||||
mParameters->SetValue( Params );
|
mParameters->SetValue( Params );
|
||||||
|
|
||||||
mInternalCommandName = Command;
|
mInternalCommandName = Command;
|
||||||
if (item < 0)
|
if (iter == mCatalog.end())
|
||||||
|
// Expose an internal name to the user in default of any friendly name
|
||||||
|
// -- AVOID THIS!
|
||||||
mCommand->SetValue( Command );
|
mCommand->SetValue( Command );
|
||||||
else {
|
else {
|
||||||
mCommand->SetValue( std::get<0>( mCommandNames[item]) );
|
mCommand->SetValue( iter->friendly /* .Translation() */ );
|
||||||
mDetails->SetValue( std::get<1>(mCommandNames[item]) + "\r\n" + std::get<2>(mCommandNames[item]) );
|
mDetails->SetValue( iter->internal + "\r\n" + iter->category );
|
||||||
mChoices->SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
|
mChoices->SetItemState(iter - mCatalog.begin(),
|
||||||
|
wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
|
||||||
|
|
||||||
EffectManager & em = EffectManager::Get();
|
EffectManager & em = EffectManager::Get();
|
||||||
PluginID ID = em.GetEffectByIdentifier(Command);
|
PluginID ID = em.GetEffectByIdentifier(Command);
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
#ifndef __AUDACITY_MACRO_COMMAND_DIALOG__
|
#ifndef __AUDACITY_MACRO_COMMAND_DIALOG__
|
||||||
#define __AUDACITY_MACRO_COMMAND_DIALOG__
|
#define __AUDACITY_MACRO_COMMAND_DIALOG__
|
||||||
|
|
||||||
#include "MemoryX.h"
|
|
||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
|
|
||||||
@ -26,6 +25,8 @@
|
|||||||
#include <wx/menuitem.h>
|
#include <wx/menuitem.h>
|
||||||
#include <wx/checklst.h>
|
#include <wx/checklst.h>
|
||||||
|
|
||||||
|
#include "BatchCommands.h"
|
||||||
|
|
||||||
class wxWindow;
|
class wxWindow;
|
||||||
class wxCheckBox;
|
class wxCheckBox;
|
||||||
class wxChoice;
|
class wxChoice;
|
||||||
@ -70,9 +71,7 @@ class MacroCommandDialog final : public wxDialogWrapper {
|
|||||||
|
|
||||||
wxString mInternalCommandName;
|
wxString mInternalCommandName;
|
||||||
|
|
||||||
using CommandName = std::tuple<wxString, wxString,wxString>;
|
const MacroCommandsCatalog mCatalog;
|
||||||
using CommandNameVector = std::vector<CommandName>;
|
|
||||||
CommandNameVector mCommandNames;
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
@ -274,19 +274,19 @@ bool MacroCommands::RenameMacro(const wxString & oldchain, const wxString & newc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Gets all commands that are valid for this mode.
|
// Gets all commands that are valid for this mode.
|
||||||
auto MacroCommands::GetAllCommands() -> CommandNameVector
|
MacroCommandsCatalog::MacroCommandsCatalog( const AudacityProject *project )
|
||||||
{
|
{
|
||||||
CommandNameVector commands;
|
|
||||||
|
|
||||||
AudacityProject *project = GetActiveProject();
|
|
||||||
if (!project)
|
if (!project)
|
||||||
return commands;
|
return;
|
||||||
|
|
||||||
// CLEANSPEECH remnant
|
// CLEANSPEECH remnant
|
||||||
|
Entries commands;
|
||||||
for( const auto &command : SpecialCommands )
|
for( const auto &command : SpecialCommands )
|
||||||
commands.push_back(
|
commands.push_back( {
|
||||||
CommandName( command.first, command.second, _("Special Command") )
|
command.first /* .Translation() */,
|
||||||
);
|
command.second,
|
||||||
|
_("Special Command")
|
||||||
|
} );
|
||||||
|
|
||||||
// end CLEANSPEECH remnant
|
// end CLEANSPEECH remnant
|
||||||
|
|
||||||
@ -298,72 +298,103 @@ auto MacroCommands::GetAllCommands() -> CommandNameVector
|
|||||||
{
|
{
|
||||||
auto command = em.GetCommandIdentifier(plug->GetID());
|
auto command = em.GetCommandIdentifier(plug->GetID());
|
||||||
if (!command.IsEmpty())
|
if (!command.IsEmpty())
|
||||||
commands.push_back(
|
commands.push_back( {
|
||||||
CommandName(
|
plug->GetUntranslatedName(), // plug->GetTranslatedName(),
|
||||||
plug->GetUntranslatedName(), // plug->GetTranslatedName(),
|
command,
|
||||||
command,
|
plug->GetPluginType() == PluginTypeEffect ?
|
||||||
plug->GetPluginType() == PluginTypeEffect ?
|
_("Effect") : _("Menu Command (With Parameters)")
|
||||||
_("Effect") : _("Menu Command (With Parameters)")
|
} );
|
||||||
)
|
|
||||||
);
|
|
||||||
plug = pm.GetNextPlugin(PluginTypeEffect|PluginTypeAudacityCommand);
|
plug = pm.GetNextPlugin(PluginTypeEffect|PluginTypeAudacityCommand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandManager * mManager = project->GetCommandManager();
|
auto mManager = project->GetCommandManager();
|
||||||
wxArrayString mLabels;
|
wxArrayString mLabels;
|
||||||
wxArrayString mNames;
|
wxArrayString mNames;
|
||||||
mLabels.Clear();
|
mLabels.Clear();
|
||||||
mNames.Clear();
|
mNames.Clear();
|
||||||
mManager->GetAllCommandLabels(mLabels, false);
|
mManager->GetAllCommandLabels(mLabels, false);
|
||||||
mManager->GetAllCommandNames(mNames, false);
|
mManager->GetAllCommandNames(mNames, false);
|
||||||
|
|
||||||
|
const bool english = wxGetLocale()->GetCanonicalName().StartsWith(wxT("en"));
|
||||||
|
|
||||||
for(size_t i=0; i<mNames.GetCount(); i++) {
|
for(size_t i=0; i<mNames.GetCount(); i++) {
|
||||||
wxString label = mLabels[i];
|
wxString label = mLabels[i];
|
||||||
if( !label.Contains( "..." ) ){
|
if( !label.Contains( "..." ) ){
|
||||||
label.Replace( "&", "" );
|
label.Replace( "&", "" );
|
||||||
wxString squashed = label;
|
bool suffix;
|
||||||
squashed.Replace( " ", "" );
|
if (!english)
|
||||||
|
suffix = true;
|
||||||
|
else {
|
||||||
|
// We'll disambiguate if the squashed name is short and shorter than the internal name.
|
||||||
|
// Otherwise not.
|
||||||
|
// This means we won't have repetitive items like "Cut (Cut)"
|
||||||
|
// But we will show important disambiguation like "All (SelectAll)" and "By Date (SortByDate)"
|
||||||
|
// Disambiguation is no longer essential as the details box will show it.
|
||||||
|
// PRL: I think this reasoning applies only when locale is English.
|
||||||
|
// For other locales, show the (CamelCaseCodeName) always. Or, never?
|
||||||
|
wxString squashed = label;
|
||||||
|
squashed.Replace( " ", "" );
|
||||||
|
|
||||||
// We'll disambiguate if the squashed name is short and shorter than the internal name.
|
suffix = squashed.Length() < wxMin( 18, mNames[i].Length());
|
||||||
// Otherwise not.
|
}
|
||||||
// This means we won't have repetitive items like "Cut (Cut)"
|
|
||||||
// But we will show important disambiguation like "All (SelectAll)" and "By Date (SortByDate)"
|
if( suffix )
|
||||||
// Disambiguation is no longer essential as the details box will show it.
|
|
||||||
if( squashed.Length() < wxMin( 18, mNames[i].Length()) )
|
|
||||||
label = label + " (" + mNames[i] + ")";
|
label = label + " (" + mNames[i] + ")";
|
||||||
|
|
||||||
commands.push_back(
|
commands.push_back(
|
||||||
CommandName(
|
{
|
||||||
label, // User readable name
|
label, // User readable name
|
||||||
mNames[i], // Internal name.
|
mNames[i], // Internal name.
|
||||||
_("Menu Command (No Parameters)")
|
_("Menu Command (No Parameters)")
|
||||||
)
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort commands by their user-visible names.
|
// Sort commands by their user-visible names.
|
||||||
// PRL: What should happen if first members of pairs are not unique?
|
// PRL: What exactly should happen if first members of pairs are not unique?
|
||||||
// Sort stably?
|
// I'm not sure, but at least I can sort stably for a better defined result,
|
||||||
std::sort(
|
// keeping specials before effects and menu items, and lastly commands.
|
||||||
commands.begin(), commands.end(),
|
auto less =
|
||||||
[](const CommandName &a, const CommandName &b)
|
[](const Entry &a, const Entry &b) { return a.friendly < b.friendly; };
|
||||||
{ return std::get<0>(a) < std::get<0>(b); }
|
std::stable_sort(commands.begin(), commands.end(), less);
|
||||||
);
|
|
||||||
|
|
||||||
// JKC: Gave up on trying to use std::unique on this.
|
// Now uniquify by friendly name
|
||||||
CommandNameVector uniqueCommands;
|
auto equal =
|
||||||
unsigned size = commands.size();
|
[](const Entry &a, const Entry &b) { return a.friendly == b.friendly; };
|
||||||
wxString oldName = "";
|
std::unique_copy(
|
||||||
for( unsigned i = 0; i < size; ++i )
|
commands.begin(), commands.end(), std::back_inserter(mCommands), equal);
|
||||||
{
|
|
||||||
if( std::get<0>( commands[i] ) != oldName )
|
|
||||||
uniqueCommands.push_back( commands[i] );
|
|
||||||
oldName = std::get<0>( commands[i] );
|
|
||||||
}
|
|
||||||
return uniqueCommands;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// binary search
|
||||||
|
auto MacroCommandsCatalog::ByFriendlyName( const wxString &friendlyName ) const
|
||||||
|
-> Entries::const_iterator
|
||||||
|
{
|
||||||
|
const auto less = [&](const Entry &entryA, const Entry &entryB)
|
||||||
|
{ return entryA.friendly < entryB.friendly; };
|
||||||
|
auto range = std::equal_range(
|
||||||
|
begin(), end(), Entry{ friendlyName }, less);
|
||||||
|
if (range.first != range.second) {
|
||||||
|
wxASSERT_MSG( range.first + 1 == range.second,
|
||||||
|
"Non-unique user-visible command name" );
|
||||||
|
return range.first;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return end();
|
||||||
|
}
|
||||||
|
|
||||||
|
// linear search
|
||||||
|
auto MacroCommandsCatalog::ByCommandId( const wxString &commandId ) const
|
||||||
|
-> Entries::const_iterator
|
||||||
|
{
|
||||||
|
// Maybe this too should have a uniqueness check?
|
||||||
|
return std::find_if( begin(), end(),
|
||||||
|
[&](const Entry &entry){ return entry.internal == commandId; });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
wxString MacroCommands::GetCurrentParamsFor(const wxString & command)
|
wxString MacroCommands::GetCurrentParamsFor(const wxString & command)
|
||||||
{
|
{
|
||||||
const PluginID & ID = EffectManager::Get().GetEffectByIdentifier(command);
|
const PluginID & ID = EffectManager::Get().GetEffectByIdentifier(command);
|
||||||
@ -564,9 +595,11 @@ bool MacroCommands::WriteMp3File( const wxString & Name, int bitrate )
|
|||||||
// and think again.
|
// and think again.
|
||||||
// ======= IMPORTANT ========
|
// ======= IMPORTANT ========
|
||||||
// CLEANSPEECH remnant
|
// CLEANSPEECH remnant
|
||||||
bool MacroCommands::ApplySpecialCommand(int WXUNUSED(iCommand), const wxString & command,const wxString & params)
|
bool MacroCommands::ApplySpecialCommand(
|
||||||
|
int WXUNUSED(iCommand), const wxString &friendlyCommand,
|
||||||
|
const wxString & command, const wxString & params)
|
||||||
{
|
{
|
||||||
if (ReportAndSkip(command, params))
|
if (ReportAndSkip(friendlyCommand, params))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
AudacityProject *project = GetActiveProject();
|
AudacityProject *project = GetActiveProject();
|
||||||
@ -643,15 +676,19 @@ bool MacroCommands::ApplySpecialCommand(int WXUNUSED(iCommand), const wxString &
|
|||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
AudacityMessageBox(wxString::Format(_("Command %s not implemented yet"),command));
|
AudacityMessageBox(
|
||||||
|
wxString::Format(_("Command %s not implemented yet"), friendlyCommand));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// end CLEANSPEECH remnant
|
// end CLEANSPEECH remnant
|
||||||
|
|
||||||
bool MacroCommands::ApplyEffectCommand(const PluginID & ID, const wxString & command, const wxString & params, const CommandContext & Context)
|
bool MacroCommands::ApplyEffectCommand(
|
||||||
|
const PluginID & ID, const wxString &friendlyCommand,
|
||||||
|
const wxString & command, const wxString & params,
|
||||||
|
const CommandContext & Context)
|
||||||
{
|
{
|
||||||
//Possibly end processing here, if in batch-debug
|
//Possibly end processing here, if in batch-debug
|
||||||
if( ReportAndSkip(command, params))
|
if( ReportAndSkip(friendlyCommand, params))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
const PluginDescriptor *plug = PluginManager::Get().GetPlugin(ID);
|
const PluginDescriptor *plug = PluginManager::Get().GetPlugin(ID);
|
||||||
@ -692,7 +729,9 @@ bool MacroCommands::ApplyEffectCommand(const PluginID & ID, const wxString & com
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroCommands::ApplyCommand(const wxString & command, const wxString & params, CommandContext const * pContext)
|
bool MacroCommands::ApplyCommand( const wxString &friendlyCommand,
|
||||||
|
const wxString & command, const wxString & params,
|
||||||
|
CommandContext const * pContext)
|
||||||
{
|
{
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -700,7 +739,7 @@ bool MacroCommands::ApplyCommand(const wxString & command, const wxString & para
|
|||||||
// CLEANSPEECH remnant
|
// CLEANSPEECH remnant
|
||||||
for( i = 0; i < sizeof(SpecialCommands)/sizeof(*SpecialCommands); ++i ) {
|
for( i = 0; i < sizeof(SpecialCommands)/sizeof(*SpecialCommands); ++i ) {
|
||||||
if( command.IsSameAs( SpecialCommands[i].second, false) )
|
if( command.IsSameAs( SpecialCommands[i].second, false) )
|
||||||
return ApplySpecialCommand( i, command, params );
|
return ApplySpecialCommand( i, friendlyCommand, command, params );
|
||||||
}
|
}
|
||||||
// end CLEANSPEECH remnant
|
// end CLEANSPEECH remnant
|
||||||
|
|
||||||
@ -709,9 +748,11 @@ bool MacroCommands::ApplyCommand(const wxString & command, const wxString & para
|
|||||||
if (!ID.empty())
|
if (!ID.empty())
|
||||||
{
|
{
|
||||||
if( pContext )
|
if( pContext )
|
||||||
return ApplyEffectCommand(ID, command, params, *pContext);
|
return ApplyEffectCommand(
|
||||||
|
ID, friendlyCommand, command, params, *pContext);
|
||||||
const CommandContext context( *GetActiveProject() );
|
const CommandContext context( *GetActiveProject() );
|
||||||
return ApplyEffectCommand(ID, command, params, context);
|
return ApplyEffectCommand(
|
||||||
|
ID, friendlyCommand, command, params, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
AudacityProject *project = GetActiveProject();
|
AudacityProject *project = GetActiveProject();
|
||||||
@ -720,7 +761,7 @@ bool MacroCommands::ApplyCommand(const wxString & command, const wxString & para
|
|||||||
if( pManager->HandleTextualCommand( command, *pContext, AlwaysEnabledFlag, AlwaysEnabledFlag ) )
|
if( pManager->HandleTextualCommand( command, *pContext, AlwaysEnabledFlag, AlwaysEnabledFlag ) )
|
||||||
return true;
|
return true;
|
||||||
pContext->Status( wxString::Format(
|
pContext->Status( wxString::Format(
|
||||||
_("Your batch command of %s was not recognized."), command ));
|
_("Your batch command of %s was not recognized."), friendlyCommand ));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -732,12 +773,13 @@ bool MacroCommands::ApplyCommand(const wxString & command, const wxString & para
|
|||||||
|
|
||||||
AudacityMessageBox(
|
AudacityMessageBox(
|
||||||
wxString::Format(
|
wxString::Format(
|
||||||
_("Your batch command of %s was not recognized."), command ));
|
_("Your batch command of %s was not recognized."), friendlyCommand ));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroCommands::ApplyCommandInBatchMode(const wxString & command, const wxString ¶ms)
|
bool MacroCommands::ApplyCommandInBatchMode( const wxString &friendlyCommand,
|
||||||
|
const wxString & command, const wxString ¶ms)
|
||||||
{
|
{
|
||||||
AudacityProject *project = GetActiveProject();
|
AudacityProject *project = GetActiveProject();
|
||||||
|
|
||||||
@ -748,14 +790,15 @@ bool MacroCommands::ApplyCommandInBatchMode(const wxString & command, const wxSt
|
|||||||
project->SetShowId3Dialog(prevShowMode);
|
project->SetShowId3Dialog(prevShowMode);
|
||||||
} );
|
} );
|
||||||
|
|
||||||
return ApplyCommand( command, params );
|
return ApplyCommand( friendlyCommand, command, params );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int MacroReentryCount = 0;
|
static int MacroReentryCount = 0;
|
||||||
// ApplyMacro returns true on success, false otherwise.
|
// ApplyMacro returns true on success, false otherwise.
|
||||||
// Any error reporting to the user in setting up the chain
|
// Any error reporting to the user in setting up the chain
|
||||||
// has already been done.
|
// has already been done.
|
||||||
bool MacroCommands::ApplyMacro(const wxString & filename)
|
bool MacroCommands::ApplyMacro(
|
||||||
|
const MacroCommandsCatalog &catalog, const wxString & filename)
|
||||||
{
|
{
|
||||||
// Check for reentrant ApplyMacro commands.
|
// Check for reentrant ApplyMacro commands.
|
||||||
// We'll allow 1 level of reentry, but not more.
|
// We'll allow 1 level of reentry, but not more.
|
||||||
@ -783,12 +826,17 @@ bool MacroCommands::ApplyMacro(const wxString & filename)
|
|||||||
mAbort = false;
|
mAbort = false;
|
||||||
|
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (; i < mCommandMacro.GetCount(); i++) {
|
for (; i < mCommandMacro.size(); i++) {
|
||||||
if (!ApplyCommandInBatchMode(mCommandMacro[i], mParamsMacro[i]) || mAbort)
|
const auto &command = mCommandMacro[i];
|
||||||
|
auto iter = catalog.ByCommandId(command);
|
||||||
|
auto friendly = (iter == catalog.end())
|
||||||
|
? command // Expose internal name to user, in default of a better one!
|
||||||
|
: iter->friendly;
|
||||||
|
if (!ApplyCommandInBatchMode(friendly, command, mParamsMacro[i]) || mAbort)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = (i == mCommandMacro.GetCount());
|
res = (i == mCommandMacro.size());
|
||||||
if (!res)
|
if (!res)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -856,7 +904,8 @@ 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(const wxString & command, const wxString & params)
|
bool MacroCommands::ReportAndSkip(
|
||||||
|
const wxString & friendlyCommand, const wxString & params)
|
||||||
{
|
{
|
||||||
int bDebug;
|
int bDebug;
|
||||||
gPrefs->Read(wxT("/Batch/Debug"), &bDebug, false);
|
gPrefs->Read(wxT("/Batch/Debug"), &bDebug, false);
|
||||||
@ -866,12 +915,12 @@ bool MacroCommands::ReportAndSkip(const wxString & command, const wxString & par
|
|||||||
//TODO: Add a cancel button to these, and add the logic so that we can abort.
|
//TODO: Add a cancel button to these, and add the logic so that we can abort.
|
||||||
if( params != wxT("") )
|
if( params != wxT("") )
|
||||||
{
|
{
|
||||||
AudacityMessageBox( wxString::Format(_("Apply %s with parameter(s)\n\n%s"),command, params),
|
AudacityMessageBox( wxString::Format(_("Apply %s with parameter(s)\n\n%s"),friendlyCommand, params),
|
||||||
_("Test Mode"));
|
_("Test Mode"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AudacityMessageBox( wxString::Format(_("Apply %s"),command),
|
AudacityMessageBox( wxString::Format(_("Apply %s"), friendlyCommand),
|
||||||
_("Test Mode"));
|
_("Test Mode"));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
#ifndef __AUDACITY_BATCH_COMMANDS_DIALOG__
|
#ifndef __AUDACITY_BATCH_COMMANDS_DIALOG__
|
||||||
#define __AUDACITY_BATCH_COMMANDS_DIALOG__
|
#define __AUDACITY_BATCH_COMMANDS_DIALOG__
|
||||||
|
|
||||||
#include "MemoryX.h"
|
|
||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
|
|
||||||
@ -20,18 +19,57 @@
|
|||||||
|
|
||||||
class Effect;
|
class Effect;
|
||||||
class CommandContext;
|
class CommandContext;
|
||||||
|
class AudacityProject;
|
||||||
|
|
||||||
|
class MacroCommandsCatalog {
|
||||||
|
public:
|
||||||
|
// A triple of user-visible name, internal string identifier and type/help string.
|
||||||
|
struct Entry {
|
||||||
|
wxString friendly;
|
||||||
|
wxString internal;
|
||||||
|
wxString category;
|
||||||
|
};
|
||||||
|
using Entries = std::vector<Entry>;
|
||||||
|
|
||||||
|
MacroCommandsCatalog( const AudacityProject *project );
|
||||||
|
|
||||||
|
// binary search
|
||||||
|
Entries::const_iterator ByFriendlyName( const wxString &friendlyName ) const;
|
||||||
|
// linear search
|
||||||
|
Entries::const_iterator ByCommandId( const wxString &commandId ) const;
|
||||||
|
|
||||||
|
// Lookup by position as sorted by friendly name
|
||||||
|
const Entry &operator[] ( size_t index ) const { return mCommands[index]; }
|
||||||
|
|
||||||
|
Entries::const_iterator begin() const { return mCommands.begin(); }
|
||||||
|
Entries::const_iterator end() const { return mCommands.end(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Sorted by friendly name
|
||||||
|
Entries mCommands;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Stores information for one chain
|
||||||
class MacroCommands final {
|
class MacroCommands final {
|
||||||
public:
|
public:
|
||||||
// constructors and destructors
|
// constructors and destructors
|
||||||
MacroCommands();
|
MacroCommands();
|
||||||
public:
|
public:
|
||||||
bool ApplyMacro(const wxString & filename = wxT(""));
|
bool ApplyMacro( const MacroCommandsCatalog &catalog,
|
||||||
bool ApplyCommand( const wxString & command, const wxString & params, CommandContext const * pContext=NULL );
|
const wxString & filename = wxT(""));
|
||||||
bool ApplyCommandInBatchMode(const wxString & command, const wxString ¶ms);
|
bool ApplyCommand( const wxString &friendlyCommand,
|
||||||
bool ApplySpecialCommand(int iCommand, const wxString & command,const wxString & params);
|
const wxString & command, const wxString & params,
|
||||||
bool ApplyEffectCommand(const PluginID & ID, const wxString & command, const wxString & params, const CommandContext & Context);
|
CommandContext const * pContext=NULL );
|
||||||
bool ReportAndSkip( const wxString & command, const wxString & params );
|
bool ApplyCommandInBatchMode( const wxString &friendlyCommand,
|
||||||
|
const wxString & command, const wxString ¶ms);
|
||||||
|
bool ApplySpecialCommand(
|
||||||
|
int iCommand, const wxString &friendlyCommand,
|
||||||
|
const wxString & command, const wxString & params);
|
||||||
|
bool ApplyEffectCommand(
|
||||||
|
const PluginID & ID, const wxString &friendlyCommand,
|
||||||
|
const wxString & command,
|
||||||
|
const wxString & params, const CommandContext & Context);
|
||||||
|
bool ReportAndSkip( const wxString & friendlyCommand, const wxString & params );
|
||||||
void AbortBatch();
|
void AbortBatch();
|
||||||
|
|
||||||
// Utility functions for the special commands.
|
// Utility functions for the special commands.
|
||||||
@ -44,12 +82,6 @@ class MacroCommands final {
|
|||||||
static wxArrayString GetNames();
|
static wxArrayString GetNames();
|
||||||
static wxArrayString GetNamesOfDefaultMacros();
|
static wxArrayString GetNamesOfDefaultMacros();
|
||||||
|
|
||||||
// A triple of user-visible name, internal string identifier and type/help string.
|
|
||||||
using CommandName = std::tuple<wxString, wxString, wxString>;
|
|
||||||
using CommandNameVector = std::vector<CommandName>;
|
|
||||||
// Result is sorted by user-visible name
|
|
||||||
static CommandNameVector GetAllCommands();
|
|
||||||
|
|
||||||
static wxString GetCurrentParamsFor(const wxString & command);
|
static wxString GetCurrentParamsFor(const wxString & command);
|
||||||
static wxString PromptForParamsFor(const wxString & command, const wxString & params, wxWindow *parent);
|
static wxString PromptForParamsFor(const wxString & command, const wxString & params, wxWindow *parent);
|
||||||
static wxString PromptForPresetFor(const wxString & command, const wxString & params, wxWindow *parent);
|
static wxString PromptForPresetFor(const wxString & command, const wxString & params, wxWindow *parent);
|
||||||
|
@ -73,6 +73,7 @@ ApplyMacroDialog::ApplyMacroDialog(wxWindow * parent, bool bInherited):
|
|||||||
wxDialogWrapper(parent, wxID_ANY, _("Apply Macro"),
|
wxDialogWrapper(parent, wxID_ANY, _("Apply Macro"),
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||||
|
, mCatalog( GetActiveProject() )
|
||||||
{
|
{
|
||||||
//AudacityProject * p = GetActiveProject();
|
//AudacityProject * p = GetActiveProject();
|
||||||
mAbort = false;
|
mAbort = false;
|
||||||
@ -269,7 +270,7 @@ void ApplyMacroDialog::ApplyMacroToProject( int iMacro, bool bHasGui )
|
|||||||
{
|
{
|
||||||
wxWindowDisabler wd(&activityWin);
|
wxWindowDisabler wd(&activityWin);
|
||||||
success = GuardedCall< bool >(
|
success = GuardedCall< bool >(
|
||||||
[this]{ return mMacroCommands.ApplyMacro(); } );
|
[this]{ return mMacroCommands.ApplyMacro(mCatalog); } );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !bHasGui )
|
if( !bHasGui )
|
||||||
@ -436,7 +437,7 @@ void ApplyMacroDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
|
|||||||
project->Import(files[i]);
|
project->Import(files[i]);
|
||||||
project->ZoomAfterImport(nullptr);
|
project->ZoomAfterImport(nullptr);
|
||||||
project->OnSelectAll(*project);
|
project->OnSelectAll(*project);
|
||||||
if (!mMacroCommands.ApplyMacro())
|
if (!mMacroCommands.ApplyMacro(mCatalog))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!activityWin.IsShown() || mAbort)
|
if (!activityWin.IsShown() || mAbort)
|
||||||
@ -547,8 +548,6 @@ MacrosWindow::~MacrosWindow()
|
|||||||
/// Creates the dialog and its contents.
|
/// Creates the dialog and its contents.
|
||||||
void MacrosWindow::Populate()
|
void MacrosWindow::Populate()
|
||||||
{
|
{
|
||||||
mCommandNames = MacroCommands::GetAllCommands();
|
|
||||||
|
|
||||||
//------------------------- Main section --------------------
|
//------------------------- Main section --------------------
|
||||||
ShuttleGui S(this, eIsCreating);
|
ShuttleGui S(this, eIsCreating);
|
||||||
PopulateOrExchange(S);
|
PopulateOrExchange(S);
|
||||||
@ -634,7 +633,7 @@ void MacrosWindow::PopulateOrExchange(ShuttleGui & S)
|
|||||||
|
|
||||||
S.StartVerticalLay(wxALIGN_TOP, 0);
|
S.StartVerticalLay(wxALIGN_TOP, 0);
|
||||||
{
|
{
|
||||||
S.AddPrompt( "Command" );
|
S.AddPrompt( _("Command") );
|
||||||
S.Id(InsertButtonID).AddButton(_("&Insert"), wxALIGN_LEFT);
|
S.Id(InsertButtonID).AddButton(_("&Insert"), wxALIGN_LEFT);
|
||||||
S.Id(EditButtonID).AddButton(_("&Edit..."), wxALIGN_LEFT);
|
S.Id(EditButtonID).AddButton(_("&Edit..."), wxALIGN_LEFT);
|
||||||
S.Id(DeleteButtonID).AddButton(_("De&lete"), wxALIGN_LEFT);
|
S.Id(DeleteButtonID).AddButton(_("De&lete"), wxALIGN_LEFT);
|
||||||
@ -643,7 +642,7 @@ void MacrosWindow::PopulateOrExchange(ShuttleGui & S)
|
|||||||
mDefaults = S.Id(DefaultsButtonID).AddButton(_("De&faults"));
|
mDefaults = S.Id(DefaultsButtonID).AddButton(_("De&faults"));
|
||||||
|
|
||||||
S.AddSpace( 30 );
|
S.AddSpace( 30 );
|
||||||
S.AddPrompt( "Macro" );
|
S.AddPrompt( _("Macro") );
|
||||||
S.Id(AddButtonID).AddButton(_("&New"));
|
S.Id(AddButtonID).AddButton(_("&New"));
|
||||||
mRemove = S.Id(RemoveButtonID).AddButton(_("Remo&ve"));
|
mRemove = S.Id(RemoveButtonID).AddButton(_("Remo&ve"));
|
||||||
mRename = S.Id(RenameButtonID).AddButton(_("&Rename..."));
|
mRename = S.Id(RenameButtonID).AddButton(_("&Rename..."));
|
||||||
@ -690,14 +689,13 @@ void MacrosWindow::PopulateList()
|
|||||||
/// Add one item into mList
|
/// Add one item into mList
|
||||||
void MacrosWindow::AddItem(const wxString &Action, const wxString &Params)
|
void MacrosWindow::AddItem(const wxString &Action, const wxString &Params)
|
||||||
{
|
{
|
||||||
// Translate internal command name to a friendly form
|
auto entry = mCatalog.ByCommandId(Action);
|
||||||
auto item = make_iterator_range(mCommandNames).index_if(
|
auto friendlyName = entry != mCatalog.end()
|
||||||
[&](const CommandName &name){ return Action == std::get<1>(name); }
|
? entry->friendly /* .Translation() */
|
||||||
);
|
:
|
||||||
auto friendlyName = item >= 0
|
// Expose an internal name to the user in default of any friendly name
|
||||||
? // wxGetTranslation
|
// -- AVOID THIS!
|
||||||
std::get<0>( mCommandNames[item] )
|
Action;
|
||||||
: Action;
|
|
||||||
|
|
||||||
int i = mList->GetItemCount();
|
int i = mList->GetItemCount();
|
||||||
|
|
||||||
|
@ -74,6 +74,9 @@ class ApplyMacroDialog : public wxDialogWrapper {
|
|||||||
bool mbExpanded;
|
bool mbExpanded;
|
||||||
wxString mActiveMacro;
|
wxString mActiveMacro;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const MacroCommandsCatalog mCatalog;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -142,10 +145,6 @@ private:
|
|||||||
int mSelectedCommand;
|
int mSelectedCommand;
|
||||||
bool mChanged;
|
bool mChanged;
|
||||||
|
|
||||||
using CommandName = std::tuple<wxString, wxString,wxString>;
|
|
||||||
using CommandNameVector = std::vector<CommandName>;
|
|
||||||
CommandNameVector mCommandNames;
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/longlong.h>
|
#include <wx/longlong.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#ifndef IN_RC
|
#ifndef IN_RC
|
||||||
|
|
||||||
class wxString;
|
class wxString;
|
||||||
@ -167,4 +169,19 @@ private:
|
|||||||
#define UTF8CTOWX(X) wxString((X), wxConvUTF8)
|
#define UTF8CTOWX(X) wxString((X), wxConvUTF8)
|
||||||
#define LAT1CTOWX(X) wxString((X), wxConvISO8859_1)
|
#define LAT1CTOWX(X) wxString((X), wxConvISO8859_1)
|
||||||
|
|
||||||
|
inline wxArrayString LocalizedStrings(const wxString strings[], size_t nStrings)
|
||||||
|
{
|
||||||
|
wxArrayString results;
|
||||||
|
std::transform( strings, strings + nStrings, std::back_inserter(results),
|
||||||
|
GetCustomTranslation );
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline wxArrayString LocalizedStrings(const wxArrayString &strings)
|
||||||
|
{
|
||||||
|
if (strings.empty())
|
||||||
|
return {};
|
||||||
|
return LocalizedStrings( &strings[0], strings.size() );
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2077,7 +2077,8 @@ ShuttleGui & ShuttleGui::Id(int id )
|
|||||||
}
|
}
|
||||||
|
|
||||||
ShuttleGui & ShuttleGui::Optional( bool &bVar ){
|
ShuttleGui & ShuttleGui::Optional( bool &bVar ){
|
||||||
TieCheckBox( "Set", bVar );
|
/* i18n-hint verb, imperative */
|
||||||
|
TieCheckBox( _("Set"), bVar );
|
||||||
return *this;
|
return *this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -39,21 +39,29 @@ OldStyleCommandPointer BatchEvalCommandType::Create(std::unique_ptr<CommandOutpu
|
|||||||
|
|
||||||
bool BatchEvalCommand::Apply(const CommandContext & context)
|
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"));
|
wxString macroName = GetString(wxT("MacroName"));
|
||||||
if (macroName != wxT(""))
|
if (macroName != wxT(""))
|
||||||
{
|
{
|
||||||
MacroCommands batch;
|
MacroCommands batch;
|
||||||
batch.ReadMacro(macroName);
|
batch.ReadMacro(macroName);
|
||||||
return batch.ApplyMacro();
|
return batch.ApplyMacro(catalog);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString cmdName = GetString(wxT("CommandName"));
|
wxString cmdName = GetString(wxT("CommandName"));
|
||||||
wxString cmdParams = GetString(wxT("ParamString"));
|
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...
|
// Create a Batch that will have just one command in it...
|
||||||
MacroCommands Batch;
|
MacroCommands Batch;
|
||||||
bool bResult = Batch.ApplyCommand(cmdName, cmdParams, &context);
|
bool bResult = Batch.ApplyCommand(friendly, cmdName, cmdParams, &context);
|
||||||
// Relay messages, if any.
|
// Relay messages, if any.
|
||||||
wxString Message = Batch.GetMessage();
|
wxString Message = Batch.GetMessage();
|
||||||
if( !Message.IsEmpty() )
|
if( !Message.IsEmpty() )
|
||||||
|
@ -1650,7 +1650,7 @@ void CommandManager::GetCategories(wxArrayString &cats)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CommandManager::GetAllCommandNames(wxArrayString &names,
|
void CommandManager::GetAllCommandNames(wxArrayString &names,
|
||||||
bool includeMultis)
|
bool includeMultis) const
|
||||||
{
|
{
|
||||||
for(const auto &entry : mCommandList) {
|
for(const auto &entry : mCommandList) {
|
||||||
if ( entry->isEffect )
|
if ( entry->isEffect )
|
||||||
@ -1663,7 +1663,7 @@ void CommandManager::GetAllCommandNames(wxArrayString &names,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CommandManager::GetAllCommandLabels(wxArrayString &names,
|
void CommandManager::GetAllCommandLabels(wxArrayString &names,
|
||||||
bool includeMultis)
|
bool includeMultis) const
|
||||||
{
|
{
|
||||||
for(const auto &entry : mCommandList) {
|
for(const auto &entry : mCommandList) {
|
||||||
// This is fetching commands from the menus, for use as batch commands.
|
// This is fetching commands from the menus, for use as batch commands.
|
||||||
|
@ -278,8 +278,8 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
|
|||||||
//
|
//
|
||||||
|
|
||||||
void GetCategories(wxArrayString &cats);
|
void GetCategories(wxArrayString &cats);
|
||||||
void GetAllCommandNames(wxArrayString &names, bool includeMultis);
|
void GetAllCommandNames(wxArrayString &names, bool includeMultis) const;
|
||||||
void GetAllCommandLabels(wxArrayString &labels, bool includeMultis);
|
void GetAllCommandLabels(wxArrayString &labels, bool includeMultis) const;
|
||||||
void GetAllCommandData(
|
void GetAllCommandData(
|
||||||
wxArrayString &names,
|
wxArrayString &names,
|
||||||
std::vector<NormalizedKeyString> &keys,
|
std::vector<NormalizedKeyString> &keys,
|
||||||
|
@ -61,7 +61,7 @@ bool DragCommand::DefineParams( ShuttleParams & S ){
|
|||||||
|
|
||||||
void DragCommand::PopulateOrExchange(ShuttleGui & S)
|
void DragCommand::PopulateOrExchange(ShuttleGui & S)
|
||||||
{
|
{
|
||||||
wxArrayString coords( nCoordTypes, kCoordTypeStrings );
|
auto coords = LocalizedStrings( kCoordTypeStrings, nCoordTypes );
|
||||||
|
|
||||||
S.AddSpace(0, 5);
|
S.AddSpace(0, 5);
|
||||||
|
|
||||||
|
@ -94,8 +94,8 @@ bool GetInfoCommand::DefineParams( ShuttleParams & S ){
|
|||||||
|
|
||||||
void GetInfoCommand::PopulateOrExchange(ShuttleGui & S)
|
void GetInfoCommand::PopulateOrExchange(ShuttleGui & S)
|
||||||
{
|
{
|
||||||
wxArrayString types( nTypes, kTypes );
|
auto types = LocalizedStrings( kTypes, nTypes );
|
||||||
wxArrayString formats( nFormats, kFormats );
|
auto formats = LocalizedStrings( kFormats, nFormats );
|
||||||
S.AddSpace(0, 5);
|
S.AddSpace(0, 5);
|
||||||
|
|
||||||
S.StartMultiColumn(2, wxALIGN_CENTER);
|
S.StartMultiColumn(2, wxALIGN_CENTER);
|
||||||
|
@ -48,7 +48,7 @@ bool GetTrackInfoCommand::DefineParams( ShuttleParams & S ){
|
|||||||
|
|
||||||
void GetTrackInfoCommand::PopulateOrExchange(ShuttleGui & S)
|
void GetTrackInfoCommand::PopulateOrExchange(ShuttleGui & S)
|
||||||
{
|
{
|
||||||
wxArrayString types( nTypes, kTypes );
|
auto types = LocalizedStrings( kTypes, nTypes );
|
||||||
S.AddSpace(0, 5);
|
S.AddSpace(0, 5);
|
||||||
|
|
||||||
S.StartMultiColumn(2, wxALIGN_CENTER);
|
S.StartMultiColumn(2, wxALIGN_CENTER);
|
||||||
|
@ -148,8 +148,8 @@ bool ScreenshotCommand::DefineParams( ShuttleParams & S ){
|
|||||||
|
|
||||||
void ScreenshotCommand::PopulateOrExchange(ShuttleGui & S)
|
void ScreenshotCommand::PopulateOrExchange(ShuttleGui & S)
|
||||||
{
|
{
|
||||||
wxArrayString whats(nCaptureWhats, kCaptureWhatStrings);
|
auto whats = LocalizedStrings(kCaptureWhatStrings, nCaptureWhats);
|
||||||
wxArrayString backs(nBackgrounds, kBackgroundStrings);
|
auto backs = LocalizedStrings(kBackgroundStrings, nBackgrounds);
|
||||||
S.AddSpace(0, 5);
|
S.AddSpace(0, 5);
|
||||||
|
|
||||||
S.StartMultiColumn(2, wxALIGN_CENTER);
|
S.StartMultiColumn(2, wxALIGN_CENTER);
|
||||||
|
@ -107,6 +107,7 @@ bool SelectFrequenciesCommand::Apply(const CommandContext & context){
|
|||||||
const int nModes =3;
|
const int nModes =3;
|
||||||
static const wxString kModes[nModes] =
|
static const wxString kModes[nModes] =
|
||||||
{
|
{
|
||||||
|
/* i18n-hint verb, imperative */
|
||||||
XO("Set"),
|
XO("Set"),
|
||||||
XO("Add"),
|
XO("Add"),
|
||||||
XO("Remove")
|
XO("Remove")
|
||||||
@ -123,7 +124,7 @@ bool SelectTracksCommand::DefineParams( ShuttleParams & S ){
|
|||||||
|
|
||||||
void SelectTracksCommand::PopulateOrExchange(ShuttleGui & S)
|
void SelectTracksCommand::PopulateOrExchange(ShuttleGui & S)
|
||||||
{
|
{
|
||||||
wxArrayString modes( nModes, kModes );
|
auto modes = LocalizedStrings( kModes, nModes );
|
||||||
S.AddSpace(0, 5);
|
S.AddSpace(0, 5);
|
||||||
|
|
||||||
S.StartMultiColumn(3, wxALIGN_CENTER);
|
S.StartMultiColumn(3, wxALIGN_CENTER);
|
||||||
|
@ -61,7 +61,7 @@ bool SetClipCommand::DefineParams( ShuttleParams & S ){
|
|||||||
|
|
||||||
void SetClipCommand::PopulateOrExchange(ShuttleGui & S)
|
void SetClipCommand::PopulateOrExchange(ShuttleGui & S)
|
||||||
{
|
{
|
||||||
wxArrayString colours( nColours, kColourStrings );
|
auto colours = LocalizedStrings( kColourStrings, nColours );
|
||||||
|
|
||||||
S.AddSpace(0, 5);
|
S.AddSpace(0, 5);
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ void SetProjectCommand::PopulateOrExchange(ShuttleGui & S)
|
|||||||
S.StartMultiColumn(3, wxALIGN_CENTER);
|
S.StartMultiColumn(3, wxALIGN_CENTER);
|
||||||
{
|
{
|
||||||
S.Optional( bHasName ).TieTextBox( _("Name:"), mName );
|
S.Optional( bHasName ).TieTextBox( _("Name:"), mName );
|
||||||
S.TieCheckBox( "Resize:", bHasSizing );
|
S.TieCheckBox( _("Resize:"), bHasSizing );
|
||||||
}
|
}
|
||||||
S.EndMultiColumn();
|
S.EndMultiColumn();
|
||||||
S.StartMultiColumn(2, wxALIGN_CENTER);
|
S.StartMultiColumn(2, wxALIGN_CENTER);
|
||||||
|
@ -123,10 +123,10 @@ bool SetTrackCommand::DefineParams( ShuttleParams & S ){
|
|||||||
|
|
||||||
void SetTrackCommand::PopulateOrExchange(ShuttleGui & S)
|
void SetTrackCommand::PopulateOrExchange(ShuttleGui & S)
|
||||||
{
|
{
|
||||||
wxArrayString colours( nColours, kColourStrings );
|
auto colours = LocalizedStrings( kColourStrings, nColours );
|
||||||
wxArrayString displays( nDisplayTypes, kDisplayTypeStrings );
|
auto displays = LocalizedStrings( kDisplayTypeStrings, nDisplayTypes );
|
||||||
wxArrayString scales( nScaleTypes, kScaleTypeStrings );
|
auto scales = LocalizedStrings( kScaleTypeStrings, nScaleTypes );
|
||||||
wxArrayString vzooms( nZoomTypes, kZoomTypeStrings );
|
auto vzooms = LocalizedStrings( kZoomTypeStrings, nZoomTypes );
|
||||||
|
|
||||||
S.AddSpace(0, 5);
|
S.AddSpace(0, 5);
|
||||||
|
|
||||||
|
@ -94,15 +94,6 @@ enum
|
|||||||
static const wxChar *KEY_Version = wxT("Version");
|
static const wxChar *KEY_Version = wxT("Version");
|
||||||
static const wxChar *KEY_Command = wxT("Command");
|
static const wxChar *KEY_Command = wxT("Command");
|
||||||
|
|
||||||
wxArrayString NyqControl::GetTranslatedChoices() const
|
|
||||||
{
|
|
||||||
wxArrayString results;
|
|
||||||
std::transform(
|
|
||||||
choices.begin(), choices.end(), std::back_inserter(results),
|
|
||||||
GetCustomTranslation);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// NyquistEffect
|
// NyquistEffect
|
||||||
@ -2405,7 +2396,7 @@ void NyquistEffect::BuildEffectWindow(ShuttleGui & S)
|
|||||||
{
|
{
|
||||||
S.AddSpace(10, 10);
|
S.AddSpace(10, 10);
|
||||||
|
|
||||||
const wxArrayString &choices = ctrl.GetTranslatedChoices();
|
auto choices = LocalizedStrings(ctrl.choices);
|
||||||
S.Id(ID_Choice + i).AddChoice( {}, wxT(""), &choices);
|
S.Id(ID_Choice + i).AddChoice( {}, wxT(""), &choices);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -53,8 +53,6 @@ public:
|
|||||||
//NyqControl( NyqControl && ) = default;
|
//NyqControl( NyqControl && ) = default;
|
||||||
//NyqControl &operator = ( NyqControl && ) = default;
|
//NyqControl &operator = ( NyqControl && ) = default;
|
||||||
|
|
||||||
wxArrayString GetTranslatedChoices() const;
|
|
||||||
|
|
||||||
int type;
|
int type;
|
||||||
wxString var;
|
wxString var;
|
||||||
wxString name;
|
wxString name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user