mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-29 23:19:28 +02:00
Fix Fade-Ends MacroCommands
- Split parameters from command name. - Improve test for 'fixed Macros'.
This commit is contained in:
parent
4dfac323c0
commit
153da3a94d
@ -87,19 +87,13 @@ static const std::pair<const wxChar*, const wxChar*> SpecialCommands[] = {
|
||||
};
|
||||
// end CLEANSPEECH remnant
|
||||
|
||||
static const wxString MP3Conversion = wxT("MP3 Conversion");
|
||||
static const wxString FadeEnds = wxT("Fade Ends");
|
||||
|
||||
MacroCommands::MacroCommands()
|
||||
{
|
||||
mMessage = "";
|
||||
ResetMacro();
|
||||
|
||||
wxArrayString names = GetNames();
|
||||
|
||||
wxArrayString defaults;
|
||||
defaults.Add( MP3Conversion );
|
||||
defaults.Add( FadeEnds );
|
||||
wxArrayString defaults = GetNamesOfDefaultMacros();
|
||||
|
||||
for( size_t i = 0;i<defaults.Count();i++){
|
||||
wxString name = defaults[i];
|
||||
@ -111,6 +105,18 @@ MacroCommands::MacroCommands()
|
||||
}
|
||||
}
|
||||
|
||||
static const wxString MP3Conversion = wxT("MP3 Conversion");
|
||||
static const wxString FadeEnds = wxT("Fade Ends");
|
||||
|
||||
|
||||
wxArrayString MacroCommands::GetNamesOfDefaultMacros()
|
||||
{
|
||||
wxArrayString defaults;
|
||||
defaults.Add( MP3Conversion );
|
||||
defaults.Add( FadeEnds );
|
||||
return defaults;
|
||||
}
|
||||
|
||||
void MacroCommands::RestoreMacro(const wxString & name)
|
||||
{
|
||||
// TIDY-ME: Effects change their name with localisation.
|
||||
@ -120,11 +126,11 @@ void MacroCommands::RestoreMacro(const wxString & name)
|
||||
AddToMacro( wxT("Normalize") );
|
||||
AddToMacro( wxT("ExportMP3") );
|
||||
} else if (name == FadeEnds ){
|
||||
AddToMacro( wxT("Select: Start=\"0\" End=\"1\"") );
|
||||
AddToMacro( wxT("Select"), wxT("Start=\"0\" End=\"1\"") );
|
||||
AddToMacro( wxT("FadeIn") );
|
||||
AddToMacro( wxT("Select: Start=\"0\" End=\"1\" FromEnd=\"1\"") );
|
||||
AddToMacro( wxT("Select"), wxT("Start=\"0\" End=\"1\" FromEnd=\"1\"") );
|
||||
AddToMacro( wxT("FadeOut") );
|
||||
AddToMacro( wxT("Select: Start=\"0\" End=\"0\"") );
|
||||
AddToMacro( wxT("Select"), wxT("Start=\"0\" End=\"0\"") );
|
||||
}
|
||||
}
|
||||
|
||||
@ -877,13 +883,12 @@ wxArrayString MacroCommands::GetNames()
|
||||
|
||||
bool MacroCommands::IsFixed(const wxString & name)
|
||||
{
|
||||
if (name == MP3Conversion)
|
||||
wxArrayString defaults = GetNamesOfDefaultMacros();
|
||||
if( defaults.Index( name ) != wxNOT_FOUND )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MacroCommands::Split(const wxString & str, wxString & command, wxString & param)
|
||||
{
|
||||
int splitAt;
|
||||
|
@ -42,6 +42,7 @@ class MacroCommands final {
|
||||
|
||||
// These commands do not depend on the command list.
|
||||
static wxArrayString GetNames();
|
||||
static wxArrayString GetNamesOfDefaultMacros();
|
||||
|
||||
// A triple of user-visible name, internal string identifier and type/help string.
|
||||
using CommandName = std::tuple<wxString, wxString, wxString>;
|
||||
|
Loading…
x
Reference in New Issue
Block a user