MacroCommandDialog remembers reference to project

This commit is contained in:
Paul Licameli 2019-05-22 07:07:57 -04:00
parent c39718fa1f
commit a769cdfe1d
3 changed files with 6 additions and 5 deletions

View File

@ -66,7 +66,7 @@ MacroCommandDialog::MacroCommandDialog(
wxDialogWrapper(parent, id, XO("Select Command"),
wxDefaultPosition, wxDefaultSize,
wxCAPTION | wxRESIZE_BORDER)
, mCatalog( &project )
, mCatalog{ &project }
{
SetLabel(XO("Select Command")); // Provide visual label
SetName(XO("Select Command")); // Provide audible label

View File

@ -86,9 +86,9 @@ ApplyMacroDialog::ApplyMacroDialog(
wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
, mMacroCommands{ project }
, mCatalog( GetActiveProject() )
, mProject{ project }
, mCatalog( &project )
{
//AudacityProject * p = GetActiveProject();
mAbort = false;
mbExpanded = false;
if( bInherited )
@ -332,7 +332,7 @@ void ApplyMacroDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
gPrefs->Write(wxT("/Batch/ActiveMacro"), name);
gPrefs->Flush();
AudacityProject *project = GetActiveProject();
AudacityProject *project = &mProject;
if (!TrackList::Get( *project ).empty()) {
AudacityMessageBox(
XO("Please save and close the current project first.") );
@ -730,7 +730,7 @@ void MacrosWindow::AddItem(const CommandID &Action, const wxString &Params)
void MacrosWindow::UpdateMenus()
{
// OK even on mac, as dialog is modal.
auto p = GetActiveProject();
auto p = &mProject;
MenuManager::Get(*p).RebuildMenuBar(*p);
}

View File

@ -63,6 +63,7 @@ class ApplyMacroDialog : public wxDialogWrapper {
wxString mMacroBeingRenamed;
protected:
AudacityProject &mProject;
const MacroCommandsCatalog mCatalog;
DECLARE_EVENT_TABLE()