1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-13 16:16:33 +01:00

Remove use of GetActiveProject in MacroCommandsDialog...

... instead pass into it the project pointer already given to ctor of
MacrosWindow
This commit is contained in:
Paul Licameli
2019-05-21 21:04:18 -04:00
parent e2539be53b
commit f85f4db704
4 changed files with 9 additions and 4 deletions

View File

@@ -61,11 +61,12 @@ BEGIN_EVENT_TABLE(MacroCommandDialog, wxDialogWrapper)
EVT_LIST_ITEM_SELECTED(CommandsListID, MacroCommandDialog::OnItemSelected) EVT_LIST_ITEM_SELECTED(CommandsListID, MacroCommandDialog::OnItemSelected)
END_EVENT_TABLE(); END_EVENT_TABLE();
MacroCommandDialog::MacroCommandDialog(wxWindow * parent, wxWindowID id): MacroCommandDialog::MacroCommandDialog(
wxWindow * parent, wxWindowID id, AudacityProject &project):
wxDialogWrapper(parent, id, XO("Select Command"), wxDialogWrapper(parent, id, XO("Select Command"),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxCAPTION | wxRESIZE_BORDER) wxCAPTION | wxRESIZE_BORDER)
, mCatalog( GetActiveProject() ) , mCatalog( &project )
{ {
SetLabel(XO("Select Command")); // Provide visual label SetLabel(XO("Select Command")); // Provide visual label
SetName(XO("Select Command")); // Provide audible label SetName(XO("Select Command")); // Provide audible label

View File

@@ -21,12 +21,13 @@ class wxTextCtrl;
class wxListCtrl; class wxListCtrl;
class wxListEvent; class wxListEvent;
class wxButton; class wxButton;
class AudacityProject;
class ShuttleGui; class ShuttleGui;
class MacroCommandDialog final : public wxDialogWrapper { class MacroCommandDialog final : public wxDialogWrapper {
public: public:
// constructors and destructors // constructors and destructors
MacroCommandDialog(wxWindow *parent, wxWindowID id); MacroCommandDialog(wxWindow *parent, wxWindowID id, AudacityProject &project);
void SetCommandAndParams(const CommandID &Command, const wxString &Params); void SetCommandAndParams(const CommandID &Command, const wxString &Params);
public: public:
CommandID mSelectedCommand; CommandID mSelectedCommand;

View File

@@ -523,6 +523,7 @@ enum {
MacrosWindow::MacrosWindow( MacrosWindow::MacrosWindow(
wxWindow * parent, AudacityProject &project, bool bExpanded): wxWindow * parent, AudacityProject &project, bool bExpanded):
ApplyMacroDialog(parent, project, true) ApplyMacroDialog(parent, project, true)
, mProject{ project }
{ {
mbExpanded = bExpanded; mbExpanded = bExpanded;
auto Title = WindowTitle(); auto Title = WindowTitle();
@@ -1063,7 +1064,7 @@ void MacrosWindow::InsertCommandAt(int item)
return; return;
} }
MacroCommandDialog d(this, wxID_ANY); MacroCommandDialog d(this, wxID_ANY, mProject);
if (!d.ShowModal()) { if (!d.ShowModal()) {
Raise(); Raise();

View File

@@ -121,6 +121,8 @@ private:
void InsertCommandAt(int item); void InsertCommandAt(int item);
bool SaveChanges(); bool SaveChanges();
AudacityProject &mProject;
wxButton *mRemove; wxButton *mRemove;
wxButton *mRename; wxButton *mRename;
wxButton *mRestore; wxButton *mRestore;