1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-26 15:23:48 +01:00

Construct all toolbars with back-reference to the project...

... and eliminate many uses of GetActiveProject
This commit is contained in:
Paul Licameli
2019-06-12 19:21:54 -04:00
parent 5751ddba4f
commit c6f24d864b
24 changed files with 149 additions and 136 deletions

View File

@@ -314,11 +314,13 @@ END_EVENT_TABLE()
//
// Constructor
//
ToolBar::ToolBar( int type,
ToolBar::ToolBar( AudacityProject &project,
int type,
const wxString &label,
const wxString &section,
bool resizable )
: wxPanelWrapper()
, mProject{ project }
{
// Save parameters
mType = type;
@@ -842,10 +844,11 @@ void ToolBar::MakeAlternateImages(AButton &button, int idx,
}
void ToolBar::SetButtonToolTip
(AButton &button, const TranslatedInternalString commands[], size_t nCommands)
(AudacityProject &theProject,
AButton &button, const TranslatedInternalString commands[], size_t nCommands)
{
wxString result;
const auto project = GetActiveProject();
const auto project = &theProject;
const auto commandManager =
project ? &CommandManager::Get( *project ) : nullptr;
if (commandManager)