Browse Source

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.
pull/2/head
Paul Licameli 11 months ago
parent
commit
e85ddf4a6d
  1. 9
      modules/mod-null/ModNullCallback.cpp
  2. 10
      modules/mod-nyq-bench/NyqBench.cpp
  3. 10
      modules/mod-script-pipe/ScripterCallback.cpp
  4. 9
      src/AudacityApp.cpp
  5. 45
      src/ModuleManager.cpp
  6. 2
      src/ModuleManager.h

9
modules/mod-null/ModNullCallback.cpp

@ -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.

10
modules/mod-nyq-bench/NyqBench.cpp

@ -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 {

10
modules/mod-script-pipe/ScripterCallback.cpp

@ -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"

9
src/AudacityApp.cpp

@ -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() ){

45
src/ModuleManager.cpp

@ -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(

2
src/ModuleManager.h

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

Loading…
Cancel
Save