1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 15:49:36 +02:00

Actually commit the mod-null changes this time!

This commit is contained in:
Leland Lucius 2016-10-01 20:23:09 -05:00
parent 01eb4745a6
commit f4d38476a6
3 changed files with 52 additions and 66 deletions

View File

@ -27,10 +27,41 @@ click from the menu into the actaul function to be called.
#include <wx/wx.h>
#include "ModNullCallback.h"
#include "../../src/Audacity.h"
#include "../../src/ShuttleGui.h"
#include "../../src/Project.h"
#include "../../src/LoadModules.h"
#include "Audacity.h"
#include "ModuleManager.h"
#include "ShuttleGui.h"
#include "Project.h"
#include "LoadModules.h"
#if defined(__WXMSW__)
#include <wx/init.h>
# if defined(__WXDEBUG__)
# define D "d"
# else
# define D ""
# endif
# if wxCHECK_VERSION(3, 1, 0)
# define V "31"
# elif wxCHECK_VERSION(3, 0, 0)
# define V "30"
# else
# define V "28"
# endif
# pragma comment(lib, "wxbase" V "u" D)
# pragma comment(lib, "wxbase" V "u" D "_net")
# pragma comment(lib, "wxmsw" V "u" D "_adv")
# pragma comment(lib, "wxmsw" V "u" D "_core")
# pragma comment(lib, "wxmsw" V "u" D "_html")
# pragma comment(lib, "wxpng" D)
# pragma comment(lib, "wxzlib" D)
# pragma comment(lib, "wxjpeg" D)
# pragma comment(lib, "wxtiff" D)
# undef V
# undef D
#endif //(__WXMSW__)
/*
There are several functions that can be used in a GUI module.
@ -61,36 +92,6 @@ public:
void OnFuncSecond();
};
typedef void (ModNullCallback::*ModNullCommandFunction)();
class ModNullCommandFunctor:public CommandFunctor
{
public:
ModNullCommandFunctor(ModNullCallback *pData,
ModNullCommandFunction pFunction);
virtual void operator()(int index = 0);
public:
ModNullCallback * mpData;
ModNullCommandFunction mpFunction;
};
ModNullCommandFunctor::ModNullCommandFunctor(ModNullCallback *pData,
ModNullCommandFunction pFunction)
{
mpData = pData;
mpFunction = pFunction;
}
// The dispatching function.
void ModNullCommandFunctor::operator()(int index )
{
(mpData->*(mpFunction))();
}
#define ModNullFN(X) new ModNullCommandFunctor(pModNullCallback, \
(ModNullCommandFunction)(&ModNullCallback::X))
void ModNullCallback::OnFuncFirst()
{
int k=32;
@ -100,15 +101,17 @@ void ModNullCallback::OnFuncSecond()
{
int k=42;
}
ModNullCallback * pModNullCallback=NULL;
#define ModNullFN(X) FNT(ModNullCallback, pModNullCallback, &ModNullCallback:: X)
extern "C" {
// GetVersionString
// REQUIRED for the module to be accepted by Audacity.
// Without it Audacity will see a version number mismatch.
MOD_NULL_DLL_API wxChar * GetVersionString()
extern DLL_API const wxChar * GetVersionString();
const wxChar * GetVersionString()
{
// Make sure that this version of the module requires the version
// of Audacity it is built with.
@ -118,7 +121,8 @@ MOD_NULL_DLL_API wxChar * GetVersionString()
}
// This is the function that connects us to Audacity.
int MOD_NULL_DLL_API ModuleDispatch(ModuleDispatchTypes type)
extern int DLL_API ModuleDispatch(ModuleDispatchTypes type);
int ModuleDispatch(ModuleDispatchTypes type)
{
switch (type)
{
@ -137,14 +141,15 @@ int MOD_NULL_DLL_API ModuleDispatch(ModuleDispatchTypes type)
wxMenu * pMenu = pBar->GetMenu( 7 ); // Menu 7 is the Analyze Menu.
CommandManager * c = p->GetCommandManager();
c->SetToMenu( pMenu );
c->SetCurrentMenu( pMenu );
c->AddSeparator();
// We add two new commands into the Analyze menu.
c->AddItem( _T("A New Command..."), _T("1st Experimental Command"),
ModNullFN( OnFuncFirst ) );
c->AddItem( _T("Another New Command..."), _T("2nd Experimental Command"),
ModNullFN( OnFuncSecond ) );
}
c->ClearCurrentMenu();
}
break;
default:
break;

View File

@ -12,27 +12,7 @@
* else gets all symbols made public, which gets messy */
/* The Visual Studio implementation */
#ifdef _MSC_VER
#define MOD_NULL_DLL_IMPORT _declspec(dllimport)
#ifdef BUILDING_MOD_NULL
#define MOD_NULL_DLL_API _declspec(dllexport)
#elif _DLL
#define MOD_NULL_DLL_API _declspec(dllimport)
#else
#define AUDACITY_DLL_API
#endif
#endif //_MSC_VER
/* The GCC implementation */
#ifdef CC_HASVISIBILITY // this is provided by the configure script, is only
// enabled for suitable GCC versions
/* The incantation is a bit weird here because it uses ELF symbol stuff. If we
* make a symbol "default" it makes it visible (for import or export). Making it
* "hidden" means it is invisible outside the shared object. */
#define MOD_NULL_DLL_IMPORT __attribute__((visibility("default")))
#ifdef BUILDING_MOD_NULL
#define MOD_NULL_DLL_API __attribute__((visibility("default")))
#else
#define MOD_NULL_DLL_API __attribute__((visibility("default")))
#endif
#define DLL_API _declspec(dllexport)
#else
#define DLL_API __attribute__ ((visibility("default")))
#endif

View File

@ -54,7 +54,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(WXWIN)\lib\vc_dll\mswud;$(WXWIN)\include;../../include;../../win;../../src;../../src/include/win32;../../src/include;../../lib-src/libsndfile/win32;../../lib-src/libsndfile/src;../../lib-src/portaudio-v19/include;../../lib-src/portmixer/include;../../lib-src/portsmf;../../lib-src/libnyquist;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>BUILDING_MOD_NULL;WXUSINGDLL;__WXMSW__;__WXDEBUG__;WIN32;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WXUSINGDLL;__WXMSW__;__WXDEBUG__;_DEBUG;WIN32;STRICT;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -78,7 +78,7 @@
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(WXWIN)\lib\vc_dll\mswu;$(WXWIN)\include;../../include;../../win;../../src;../../src/include/win32;../../src/include;../../lib-src/libsndfile/win32;../../lib-src/libsndfile/src;../../lib-src/portaudio-v19/include;../../lib-src/portmixer/include;../../lib-src/portsmf;../../lib-src/libnyquist;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>BUILDING_MOD_NULL;WXUSINGDLL;__WXMSW__;WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>wxDEBUG_LEVEL=0;WXUSINGDLL;__WXMSW__;WIN32;NDEBUG;STRICT;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
@ -86,13 +86,14 @@
</ClCompile>
<Link>
<AdditionalDependencies>audacity.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)modules\$(ProjectName).dll</OutputFile>
<AdditionalLibraryDirectories>$(WXWIN)\lib\vc_dll;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<OutputFile>..\..\win\$(ConfigurationName)\modules\$(ProjectName).dll</OutputFile>
<AdditionalLibraryDirectories>../../win/$(Configuration);$(WXWIN)\lib\vc_dll;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>