mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-02 15:13:50 +01:00
Add `locale/en.po` file. Add English to `locale/LINGUAS` list. Partially duplicate `msgid`s to `msgstr`s in English locale enable eventual key `msgid` changes Replace former project name with Tenacity in English locale. Replace former project website with Tenacity compatible usages in English locale. Modify `AboutDialog.h` by renaming variables. Modify `AboutDialog.cpp` by replacing usage of pre-fork name in Strings. Modify AddBuildInfoRow methods to be static in About dialog. Make License text const in About dialog. Make pre-fork credits different in About dialog. Begin adding Tenacity specific credits Macros starting with `__` are reserved, so I removed the `__` on the About Dialog guard macro. Remove `AboutDialog::` from usage of `Role` in `AboutDialog.h` Refactor overly long generator method into separate methods in `AboutDialog.(h|cpp)` Begin adding Tenacity developer information Cleanup layout of `AboutDialog.h` and `AboutDialog.cpp` Add `safedelete` macro to compliment odd `safenew` macro Add `enum` to `ShuttleGui.cpp` to make it more clear what `Prop` method is doing. Remove a ton of pointless and/or redunant `#ifdef` usage Remove pointless singleton in AboutDialog Make AboutDialog modal on MacOS Fix reference type use of `auto` in `AudacityApp` b/c it makes unintentional copy. Update XPM and PNG images using Tenacity assets Update ICO images using Tenacity assets. Fix Windows resource script that improperly used `winuser.h` import. Add `*.aps` to gitignore to prevent IDE RC pre-load file from being committed. Add default values for pre-processor constants in `tenacity.rc`. Make changes needed for `Tenacity.exe` binary Add 8x8 PNG to Windows ICO files Replace project name in various CMake and CPack file. Replace project name in various directory structures. Replace project name in various OS-specific build files. Replace project name in various documentation files. Update the PO and POT files using the script. Fix places where a `.desktop` file was used on Linux. Replace title of project windows. Make splash screen click through to `tenacityaudio.org`. Remove ® from `AboutDialog.cpp` Modify copyright message in `AboutDialog.cpp` Signed-off-by: Emily Mabrey <emilymabrey93@gmail.com>
157 lines
4.5 KiB
C++
157 lines
4.5 KiB
C++
/**********************************************************************
|
|
|
|
Tenacity
|
|
|
|
ModuleManager.h
|
|
|
|
Dominic Mazzoni
|
|
James Crook
|
|
|
|
**********************************************************************/
|
|
|
|
#ifndef __AUDACITY_MODULEMANAGER_H__
|
|
#define __AUDACITY_MODULEMANAGER_H__
|
|
|
|
#include "MemoryX.h"
|
|
#include <functional>
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
#include "tenacity/Types.h"
|
|
#include "Identifier.h"
|
|
|
|
class wxArrayString;
|
|
class wxDynamicLibrary;
|
|
class ComponentInterface;
|
|
class ModuleInterface;
|
|
class wxWindow;
|
|
|
|
//
|
|
// Module Manager
|
|
//
|
|
// wxPluginManager would be MUCH better, but it's an "undocumented" framework.
|
|
//
|
|
|
|
#include "ModuleConstants.h"
|
|
|
|
typedef int (*fnModuleDispatch)(ModuleDispatchTypes type);
|
|
|
|
class Module
|
|
{
|
|
public:
|
|
Module(const FilePath & name);
|
|
virtual ~Module();
|
|
|
|
void ShowLoadFailureError(const wxString &Error);
|
|
bool Load(wxString &deferredErrorMessage);
|
|
void Unload();
|
|
bool HasDispatch() { return mDispatch != NULL; };
|
|
int Dispatch(ModuleDispatchTypes type);
|
|
void * GetSymbol(const wxString &name);
|
|
const FilePath &GetName() const { return mName; }
|
|
|
|
private:
|
|
const FilePath mName;
|
|
std::unique_ptr<wxDynamicLibrary> mLib;
|
|
fnModuleDispatch mDispatch;
|
|
};
|
|
|
|
struct ModuleInterfaceDeleter {
|
|
void operator ()(ModuleInterface *pInterface) const;
|
|
};
|
|
|
|
using ModuleInterfaceHandle = std::unique_ptr<
|
|
ModuleInterface, ModuleInterfaceDeleter
|
|
>;
|
|
|
|
typedef std::map<wxString, ModuleInterfaceHandle> ModuleMap;
|
|
typedef std::map<ModuleInterface *, std::unique_ptr<wxDynamicLibrary>> LibraryMap;
|
|
using PluginIDs = wxArrayString;
|
|
|
|
class AUDACITY_DLL_API ModuleManager final
|
|
{
|
|
public:
|
|
|
|
// -------------------------------------------------------------------------
|
|
// ModuleManager implementation
|
|
// -------------------------------------------------------------------------
|
|
|
|
static ModuleManager & Get();
|
|
|
|
// This string persists in configuration files
|
|
// So config compatibility will break if it is changed across Audacity versions
|
|
static wxString GetPluginTypeString();
|
|
|
|
static PluginID GetID(ModuleInterface *module);
|
|
|
|
private:
|
|
static void FindModules(FilePaths &files);
|
|
using DelayedErrors =
|
|
std::vector< std::pair< std::unique_ptr<Module>, wxString > >;
|
|
static void TryLoadModules(
|
|
const FilePaths &files, FilePaths &decided, DelayedErrors &errors);
|
|
|
|
public:
|
|
void Initialize();
|
|
int Dispatch(ModuleDispatchTypes type);
|
|
|
|
// PluginManager use
|
|
// Can be called before Initialize()
|
|
bool DiscoverProviders();
|
|
|
|
// Supports range-for iteration
|
|
auto Providers() const
|
|
{ return make_iterator_range(mDynModules.cbegin(), mDynModules.cend()); }
|
|
|
|
bool RegisterEffectPlugin(const PluginID & provider, const PluginPath & path,
|
|
TranslatableString &errMsg);
|
|
|
|
ModuleInterface *CreateProviderInstance(
|
|
const PluginID & provider, const PluginPath & path);
|
|
std::unique_ptr<ComponentInterface>
|
|
CreateInstance(const PluginID & provider, const PluginPath & path);
|
|
|
|
bool IsProviderValid(const PluginID & provider, const PluginPath & path);
|
|
bool IsPluginValid(const PluginID & provider, const PluginPath & path, bool bFast);
|
|
|
|
private:
|
|
// I'm a singleton class
|
|
ModuleManager();
|
|
~ModuleManager();
|
|
ModuleManager(const ModuleManager&) PROHIBITED;
|
|
ModuleManager &operator=(const ModuleManager&) PROHIBITED;
|
|
|
|
void InitializeBuiltins();
|
|
|
|
private:
|
|
friend ModuleInterfaceDeleter;
|
|
friend std::default_delete<ModuleManager>;
|
|
static std::unique_ptr<ModuleManager> mInstance;
|
|
|
|
// Module objects, also called Providers, can each report availability of any
|
|
// number of Plug-Ins identified by "paths", and are also factories of
|
|
// ComponentInterface objects for each path:
|
|
ModuleMap mDynModules;
|
|
|
|
// Other libraries that receive notifications of events described by
|
|
// ModuleDispatchTypes:
|
|
std::vector<std::unique_ptr<Module>> mModules;
|
|
};
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// The module entry point prototype (a factory of ModuleInterface objects)
|
|
// ----------------------------------------------------------------------------
|
|
using ModuleMain = ModuleInterface *(*)();
|
|
|
|
AUDACITY_DLL_API
|
|
void RegisterProvider(ModuleMain rtn);
|
|
AUDACITY_DLL_API
|
|
void UnregisterProvider(ModuleMain rtn);
|
|
|
|
// Guarantee the registry exists before any registrations, so it will
|
|
// be destroyed only after the un-registrations
|
|
static struct Init{
|
|
Init() { RegisterProvider(nullptr); } } sInitBuiltinModules;
|
|
|
|
#endif /* __AUDACITY_MODULEMANAGER_H__ */
|