1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-03-06 14:35:32 +01:00

Added SkewedRuler and started on registration system.

This commit is contained in:
james.k.crook@gmail.com
2011-04-25 20:22:01 +00:00
parent 9321b1634e
commit b45d9ae327
6 changed files with 291 additions and 14 deletions

View File

@@ -21,3 +21,54 @@ plugging in of new resources.
#include <wx/wx.h>
#include "Registrar.h"
START_NAMESPACE
Registrar * pRegistrar = NULL;
// By defining the external function and including it here, we save ourselves maintaing two lists.
// Also we save ourselves recompiling Registrar each time the classes that regiser change.
// Part of the idea is that the Registrar knows very little about the classes that
// register with it.
#define DISPATCH( Name ) extern int Name##Dispatch( Registrar & R, t_RegistrarDispatchType Type );\
Name##Dispatch( *pRegistrar, Type )
// Not a class function, otherwise the functions called
// are treated as belonging to the class.
int RegistrarDispatch( t_RegistrarDispatchType Type )
{
wxASSERT( pRegistrar != NULL );
DISPATCH( SkewedRuler );
DISPATCH( MidiArtist );
DISPATCH( WaveArtist );
DISPATCH( EnvelopeArtist );
DISPATCH( LabelArtist );
DISPATCH( DragGridSizer );
return 0;
}
// Start()
// Static function. Allocates Registrar.
void Registrar::Start()
{
wxASSERT( pRegistrar ==NULL );
pRegistrar = new Registrar();
RegistrarDispatch( RegArtist );
RegistrarDispatch( RegDataType );
RegistrarDispatch( RegCommand );
RegistrarDispatch( RegMenuItem );
}
// Finish()
// Static function. DeAllocates Registrar.
void Registrar::Finish()
{
wxASSERT( pRegistrar !=NULL );
delete pRegistrar;
pRegistrar = NULL;
}
};//End of Namespace.