1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-29 15:19:44 +02:00

Remove track panel hijack hooks from ModuleManager...

... It ended up not used, and long ago superseded by other TrackPanel
reorganization.

Such things as that (and many more) will be implemented with different
idioms (registries in various higher level code) without requiring changes in
this low level protocol for loading modules.
This commit is contained in:
Paul Licameli 2021-03-02 10:21:25 -05:00
parent bbda68c079
commit e85ddf4a6d
6 changed files with 5 additions and 80 deletions

View File

@ -34,15 +34,8 @@ click from the menu into the actual function to be called.
#include "CommonCommandFlags.h"
/*
There are several functions that can be used in a GUI module.
//#define ModuleDispatchName "ModuleDispatch"
The most useful function. See the example in this
file. It has several cases/options in it.
//#define mainPanelFnName "MainPanelFunc"
This function is the hijacking function, to take over Audacity
and replace the main project window with our own wxFrame.
See the example in this file. It has several cases/options in it.
*/
// derived from wxFrame as it needs to be some kind of event handler.

View File

@ -90,16 +90,8 @@
#include "images/media-playback-stop-large.xpm"
/*
There are several functions that can be used in a GUI module.
//#define ModuleDispatchName "ModuleDispatch"
The most useful function. See the example in this
file. It has several cases/options in it.
//#define mainPanelFnName "MainPanelFunc"
This function is the hijacking function, to take over Audacity
and replace the main project window with our own wxFrame.
See the example in this file. It has several cases/options in it.
*/
namespace {

View File

@ -18,16 +18,8 @@
#include "commands/ScriptCommandRelay.h"
/*
There are several functions that can be used in a GUI module.
//#define ModuleDispatchName "ModuleDispatch"
The most useful function. See the example in this
file. It has several cases/options in it.
//#define mainPanelFnName "MainPanelFunc"
This function is the hijacking function, to take over Audacity
and replace the main project window with our own wxFrame.
See the example in this file. It has several cases/options in it.
*/
#include "ModuleConstants.h"

View File

@ -1456,15 +1456,6 @@ bool AudacityApp::InitPart2()
// seemed to arrive with wx3.
{
project = ProjectManager::New();
wxWindow * pWnd = MakeHijackPanel();
if (pWnd)
{
auto &window = GetProjectFrame( *project );
window.Show(false);
pWnd->SetParent( &window );
SetTopWindow(pWnd);
pWnd->Show(true);
}
}
if( ProjectSettings::Get( *project ).GetShowSplashScreen() ){

View File

@ -45,37 +45,9 @@ i.e. an alternative to the usual interface, for Audacity.
#define initFnName "ExtensionModuleInit"
#define versionFnName "GetVersionString"
#define mainPanelFnName "MainPanelFunc"
typedef wxWindow * pwxWindow;
typedef int (*tModuleInit)(int);
//typedef wxString (*tVersionFn)();
typedef wxChar * (*tVersionFn)();
typedef pwxWindow (*tPanelFn)(int);
// This variable will hold the address of a subroutine in
// a DLL that can hijack the normal panel.
static tPanelFn pPanelHijack=NULL;
// Next two commented out lines are handy when investigating
// strange DLL behaviour. Instead of dynamic linking,
// link the library which has the replacement panel statically.
// Give the address of the routine here.
// This is a great help in identifying missing
// symbols which otherwise cause a dll to unload after loading
// without an explanation as to why!
//extern wxWindow * MainPanelFunc( int i );
//tPanelFn pPanelHijack=&MainPanelFunc;
/// IF pPanelHijack has been found in a module DLL
/// THEN when this function is called we'll go and
/// create that window instead of the normal one.
wxWindow * MakeHijackPanel()
{
if( pPanelHijack == NULL )
return NULL;
return pPanelHijack(0);
}
Module::Module(const FilePath & name)
: mName{ name }
@ -144,8 +116,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 hijacking the entire Audacity panel (MainPanelFunc entry point)
// Module does not provide a dispatch function.
return true;
}
@ -340,19 +311,7 @@ void ModuleManager::TryLoadModules(
decided.Add( ShortName );
auto module = umodule.get();
{
// We've loaded and initialised OK.
// 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 hijacking the entire Audacity panel.
if (pPanelHijack == NULL)
{
pPanelHijack = (tPanelFn)(module->GetSymbol(wxT(mainPanelFnName)));
}
}
if (!module->HasDispatch() && !pPanelHijack)
if (!module->HasDispatch())
{
auto ShortName = wxFileName(file).GetName();
AudacityMessageBox(

View File

@ -23,8 +23,6 @@ class wxDynamicLibrary;
class ComponentInterface;
class ModuleInterface;
wxWindow * MakeHijackPanel();
//
// Module Manager
//