1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-01-02 22:27:10 +01:00

Add details box to BatchCommandDialog

It is now populated with the CommandID and the command type.
Later we can add the command help string.

Std::pair changed to std::tuple to accommodate the extra information.
This commit is contained in:
James Crook
2018-03-01 19:23:46 +00:00
parent f5929381ec
commit bf03fd874b
6 changed files with 56 additions and 48 deletions

View File

@@ -258,11 +258,9 @@ auto BatchCommands::GetAllCommands() -> CommandNameVector
// CLEANSPEECH remnant
for( const auto &command : SpecialCommands )
commands.push_back( {
//wxGetTranslation
(command.first),
command.second
} );
commands.push_back(
CommandName( command.first, command.second, _("Special Command") )
);
// end CLEANSPEECH remnant
@@ -274,10 +272,14 @@ auto BatchCommands::GetAllCommands() -> CommandNameVector
{
auto command = em.GetCommandIdentifier(plug->GetID());
if (!command.IsEmpty())
commands.push_back( {
plug->GetUntranslatedName(), // plug->GetTranslatedName(),
command
} );
commands.push_back(
CommandName(
plug->GetUntranslatedName(), // plug->GetTranslatedName(),
command,
plug->GetPluginType() == PluginTypeEffect ?
_("Effect") : _("Menu Command (With Parameters)")
)
);
plug = pm.GetNextPlugin(PluginTypeEffect|PluginTypeAudacityCommand);
}
}
@@ -290,13 +292,26 @@ auto BatchCommands::GetAllCommands() -> CommandNameVector
mManager->GetAllCommandLabels(mLabels, false);
mManager->GetAllCommandNames(mNames, false);
for(size_t i=0; i<mNames.GetCount(); i++) {
if( !mLabels[i].Contains( "..." ) ){
mLabels[i].Replace( "&", "" );
wxString label = mLabels[i];
if( !label.Contains( "..." ) ){
label.Replace( "&", "" );
wxString squashed = label;
squashed.Replace( " ", "" );
// 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.
if( squashed.Length() < wxMin( 18, mNames[i].Length()) )
label = label + " (" + mNames[i] + ")";
commands.push_back(
{
mLabels[i] + " (" + mNames[i] + ")", // User readable name
mNames[i] // Internal name.
}
CommandName(
label, // User readable name
mNames[i], // Internal name.
_("Menu Command (No Parameters)")
)
);
}
}
@@ -307,7 +322,7 @@ auto BatchCommands::GetAllCommands() -> CommandNameVector
std::sort(
commands.begin(), commands.end(),
[](const CommandName &a, const CommandName &b)
{ return a.first < b.first; }
{ return std::get<0>(a) < std::get<0>(b); }
);