1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 00:20:06 +02:00
audacity/src/LoadModules.h
martynshaw99 37f74e27bb Adding the ability to load 'non-recognised' modules, with a warning to the user (the main point).
Removing duplicate code from LoadModules, at the expense of making  ModuleManager::Initialize more monolithic.

Make MultiDialog a bit more general.

Remove a few warnings.

Some logging has been turned back on when loading libs, we could turn it off again.

To test you could compile mod-nyq-bench and make sure it is available on the bottom of the 'View' menu, then unselect it in the Prefs -> Modules an retry.
2013-06-05 00:35:10 +00:00

80 lines
1.5 KiB
C++

/**********************************************************************
Audacity: A Digital Audio Editor
LoadModules.h
Dominic Mazzoni
James Crook
**********************************************************************/
#ifndef __AUDACITY_LOADMODULES_H__
#define __AUDACITY_LOADMODULES_H__
#include <wx/dynlib.h>
#include <wx/module.h>
class CommandHandler;
wxWindow * MakeHijackPanel();
//
// Module Manager
//
// wxPluginManager would be MUCH better, but it's an "undocumented" framework.
//
#define ModuleDispatchName "ModuleDispatch"
typedef enum
{
ModuleInitialize,
ModuleTerminate,
AppInitialized,
AppQuiting,
ProjectInitialized,
ProjectClosing,
MenusRebuilt
} ModuleDispatchTypes;
typedef int (*fnModuleDispatch)(ModuleDispatchTypes type);
class Module
{
public:
Module(const wxString & name);
virtual ~Module();
bool Load();
void Unload();
int Dispatch(ModuleDispatchTypes type);
void * GetSymbol(wxString name);
private:
wxString mName;
wxDynamicLibrary *mLib;
fnModuleDispatch mDispatch;
};
class ModuleManager:public wxModule
{
public:
ModuleManager() {};
virtual ~ModuleManager() {};
virtual bool OnInit();
virtual void OnExit();
static void Initialize(CommandHandler &cmdHandler);
static int Dispatch(ModuleDispatchTypes type);
private:
static ModuleManager *mInstance;
wxArrayPtrVoid mModules;
DECLARE_DYNAMIC_CLASS(ModuleManager);
};
#endif /* __AUDACITY_LOADMODULES_H__ */