1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-01-02 14:17:07 +01:00

Break dependency cycle introduced at a69fba9

This commit is contained in:
Paul Licameli
2020-01-19 14:20:44 -05:00
parent f2ed21f9e5
commit 2ec2ad378d
9 changed files with 89 additions and 79 deletions

View File

@@ -40,53 +40,6 @@ Paul Licameli split from TrackPanel.cpp
#include "../../../ui/ButtonHandle.h"
#include "../../../../TrackInfo.h"
namespace {
class Registry {
public:
using Type = WaveTrackSubView::Type;
using Types = std::vector< Type >;
void Append( Type type )
{
types.emplace_back( std::move( type ) );
sorted = false;
}
Types &Get()
{
if ( !sorted ) {
auto begin = types.begin(), end = types.end();
std::sort( begin, end );
// We don't want duplicate ids!
wxASSERT( end == std::adjacent_find( begin, end ) );
sorted = true;
}
return types;
}
private:
Types types;
bool sorted = false;
};
Registry &GetRegistry()
{
static Registry result;
return result;
}
}
WaveTrackSubView::RegisteredType::RegisteredType( Type type )
{
GetRegistry().Append( std::move( type ) );
}
// static
auto WaveTrackSubView::AllTypes() -> const Types &
{
return GetRegistry().Get();
}
namespace {
using WaveTrackSubViewPtrs = std::vector< std::shared_ptr< WaveTrackSubView > >;