mirror of
https://github.com/cookiengineer/audacity
synced 2026-02-16 07:47:58 +01:00
static DirManager::Get()...
... not member functions of AudacityProject This puts DirManager.cpp and four others back into the big strongly connected component of link dependencies. They will break out again when Project.cpp becomes a low-level file.
This commit is contained in:
@@ -89,6 +89,7 @@
|
||||
#include "FileNames.h"
|
||||
#include "InconsistencyException.h"
|
||||
#include "Prefs.h"
|
||||
#include "Project.h"
|
||||
#include "widgets/Warning.h"
|
||||
#include "widgets/AudacityMessageBox.h"
|
||||
#include "widgets/ProgressDialog.h"
|
||||
@@ -361,6 +362,32 @@ std::shared_ptr<DirManager> DirManager::Create()
|
||||
return result;
|
||||
}
|
||||
|
||||
static const AudacityProject::AttachedObjects::RegisteredFactory key{
|
||||
[](AudacityProject&) { return DirManager::Create(); }
|
||||
};
|
||||
|
||||
DirManager &DirManager::Get( AudacityProject &project )
|
||||
{
|
||||
return project.AttachedObjects::Get< DirManager >( key );
|
||||
}
|
||||
|
||||
const DirManager &DirManager::Get( const AudacityProject &project )
|
||||
{
|
||||
return Get( const_cast< AudacityProject & >( project ) );
|
||||
}
|
||||
|
||||
DirManager &DirManager::Reset( AudacityProject &project )
|
||||
{
|
||||
auto dirManager = DirManager::Create();
|
||||
project.AttachedObjects::Assign( key, dirManager );
|
||||
return *dirManager;
|
||||
}
|
||||
|
||||
void DirManager::Destroy( AudacityProject &project )
|
||||
{
|
||||
project.AttachedObjects::Assign( key, nullptr );
|
||||
}
|
||||
|
||||
DirManager::DirManager()
|
||||
{
|
||||
wxLogDebug(wxT("DirManager: Created new instance."));
|
||||
|
||||
Reference in New Issue
Block a user