1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-15 17:11:20 +01:00

Use names not numbers in MacroIdOfName()

Previously the ID for a macro was, e.g. Macro003.  However this would
not work if macros were added or deleted, since chains containing the old
macro references would now refer to a different macro.  So changed to using
names.
This commit is contained in:
James Crook
2018-03-04 19:02:22 +00:00
parent 585a4c6170
commit 70b1f69bbe
3 changed files with 32 additions and 1 deletions

View File

@@ -192,6 +192,27 @@ void ApplyMacroDialog::OnApplyToProject(wxCommandEvent & WXUNUSED(event))
ApplyMacroToProject( item );
}
wxString ApplyMacroDialog::MacroIdOfName( const wxString & MacroName )
{
wxString Temp = MacroName;
Temp.Replace(" ","");
Temp = wxString( "Macro_" ) + Temp;
return Temp;
}
// Does nothing if not found, rather than returning an error.
void ApplyMacroDialog::ApplyMacroToProject( const wxString & MacroID, bool bHasGui )
{
for( size_t i=0;i<mMacros->GetItemCount();i++){
wxString name = mMacros->GetItemText(i);
if( MacroIdOfName( name ) == MacroID ){
ApplyMacroToProject( i, bHasGui );
return;
}
}
}
void ApplyMacroDialog::ApplyMacroToProject( int iMacro, bool bHasGui )
{
wxString name = mMacros->GetItemText(iMacro);