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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user