mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-29 23:29:41 +02:00
ModuleManager doesn't specially start up mod-script-pipe...
... The standard module dispatch can do that.
This commit is contained in:
parent
c7834257d8
commit
bbda68c079
@ -39,10 +39,6 @@ There are several functions that can be used in a GUI module.
|
||||
The most useful function. See the example in this
|
||||
file. It has several cases/options in it.
|
||||
|
||||
//#define scriptFnName "RegScriptServerFunc"
|
||||
This function is run from a non gui thread. It was originally
|
||||
created for the benefit of mod-script-pipe.
|
||||
|
||||
//#define mainPanelFnName "MainPanelFunc"
|
||||
This function is the hijacking function, to take over Audacity
|
||||
and replace the main project window with our own wxFrame.
|
||||
|
@ -96,10 +96,6 @@ There are several functions that can be used in a GUI module.
|
||||
The most useful function. See the example in this
|
||||
file. It has several cases/options in it.
|
||||
|
||||
//#define scriptFnName "RegScriptServerFunc"
|
||||
This function is run from a non gui thread. It was originally
|
||||
created for the benefit of mod-script-pipe.
|
||||
|
||||
//#define mainPanelFnName "MainPanelFunc"
|
||||
This function is the hijacking function, to take over Audacity
|
||||
and replace the main project window with our own wxFrame.
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include "ScripterCallback.h"
|
||||
#include "commands/ScriptCommandRelay.h"
|
||||
|
||||
/*
|
||||
There are several functions that can be used in a GUI module.
|
||||
@ -23,10 +24,6 @@ There are several functions that can be used in a GUI module.
|
||||
The most useful function. See the example in this
|
||||
file. It has several cases/options in it.
|
||||
|
||||
//#define scriptFnName "RegScriptServerFunc"
|
||||
This function is run from a non gui thread. It was originally
|
||||
created for the benefit of mod-script-pipe.
|
||||
|
||||
//#define mainPanelFnName "MainPanelFunc"
|
||||
This function is the hijacking function, to take over Audacity
|
||||
and replace the main project window with our own wxFrame.
|
||||
@ -40,8 +37,6 @@ typedef DLL_IMPORT int (*tpExecScriptServerFunc)( wxString * pIn, wxString * pOu
|
||||
static tpExecScriptServerFunc pScriptServerFn=NULL;
|
||||
|
||||
|
||||
DEFINE_MODULE_ENTRIES
|
||||
|
||||
extern "C" {
|
||||
|
||||
// And here is our special registration function.
|
||||
@ -56,6 +51,18 @@ int DLL_API RegScriptServerFunc( tpExecScriptServerFunc pFn )
|
||||
return 4;
|
||||
}
|
||||
|
||||
DEFINE_VERSION_CHECK
|
||||
extern "C" DLL_API int ModuleDispatch(ModuleDispatchTypes type)
|
||||
{
|
||||
switch (type) {
|
||||
case ModuleInitialize:
|
||||
ScriptCommandRelay::StartScriptServer(RegScriptServerFunc);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
wxString Str2;
|
||||
wxArrayString aStr;
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
\file ModuleManager.cpp
|
||||
\brief Based on LoadLadspa, this code loads pluggable Audacity
|
||||
extension modules. It also has the code to (a) invoke a script
|
||||
server and (b) invoke a function returning a replacement window,
|
||||
extension modules. It also has the code to
|
||||
invoke a function returning a replacement window,
|
||||
i.e. an alternative to the usual interface, for Audacity.
|
||||
|
||||
*//*******************************************************************/
|
||||
@ -32,8 +32,6 @@ i.e. an alternative to the usual interface, for Audacity.
|
||||
#include "FileNames.h"
|
||||
#include "PluginManager.h"
|
||||
|
||||
#include "commands/ScriptCommandRelay.h"
|
||||
|
||||
#include "audacity/PluginInterface.h"
|
||||
|
||||
#ifdef EXPERIMENTAL_MODULE_PREFS
|
||||
@ -47,7 +45,6 @@ i.e. an alternative to the usual interface, for Audacity.
|
||||
|
||||
#define initFnName "ExtensionModuleInit"
|
||||
#define versionFnName "GetVersionString"
|
||||
#define scriptFnName "RegScriptServerFunc"
|
||||
#define mainPanelFnName "MainPanelFunc"
|
||||
|
||||
typedef wxWindow * pwxWindow;
|
||||
@ -80,10 +77,6 @@ wxWindow * MakeHijackPanel()
|
||||
return pPanelHijack(0);
|
||||
}
|
||||
|
||||
// This variable will hold the address of a subroutine in a DLL that
|
||||
// starts a thread and reads script commands.
|
||||
static tpRegScriptServerFunc scriptFn;
|
||||
|
||||
Module::Module(const FilePath & name)
|
||||
: mName{ name }
|
||||
{
|
||||
@ -152,8 +145,7 @@ bool Module::Load(wxString &deferredErrorMessage)
|
||||
mDispatch = (fnModuleDispatch) mLib->GetSymbol(wxT(ModuleDispatchName));
|
||||
if (!mDispatch) {
|
||||
// Module does not provide a dispatch function. Special case modules like this could be:
|
||||
// (a) for scripting (RegScriptServerFunc entry point)
|
||||
// (b) for hijacking the entire Audacity panel (MainPanelFunc entry point)
|
||||
// (a) for hijacking the entire Audacity panel (MainPanelFunc entry point)
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -353,20 +345,14 @@ void ModuleManager::TryLoadModules(
|
||||
// So look for special case functions:
|
||||
wxLogNull logNo; // Don't show wxWidgets errors if we can't do these. (Was: Fix bug 544.)
|
||||
|
||||
// (a) for scripting.
|
||||
if (scriptFn == NULL)
|
||||
{
|
||||
scriptFn = (tpRegScriptServerFunc)(module->GetSymbol(wxT(scriptFnName)));
|
||||
}
|
||||
|
||||
// (b) for hijacking the entire Audacity panel.
|
||||
// (a) for hijacking the entire Audacity panel.
|
||||
if (pPanelHijack == NULL)
|
||||
{
|
||||
pPanelHijack = (tPanelFn)(module->GetSymbol(wxT(mainPanelFnName)));
|
||||
}
|
||||
}
|
||||
|
||||
if (!module->HasDispatch() && !scriptFn && !pPanelHijack)
|
||||
if (!module->HasDispatch() && !pPanelHijack)
|
||||
{
|
||||
auto ShortName = wxFileName(file).GetName();
|
||||
AudacityMessageBox(
|
||||
@ -420,12 +406,6 @@ void ModuleManager::Initialize()
|
||||
pModule->ShowLoadFailureError(pair.second);
|
||||
ModulePrefs::SetModuleStatus( pModule->GetName(), kModuleFailed );
|
||||
}
|
||||
|
||||
// After loading all the modules, we may have a registered scripting function.
|
||||
if(scriptFn)
|
||||
{
|
||||
ScriptCommandRelay::StartScriptServer(scriptFn);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
|
Loading…
x
Reference in New Issue
Block a user