diff --git a/lib-src/mod-null/ModNullCallback.cpp b/lib-src/mod-null/ModNullCallback.cpp index 9beeceb49..cec12d018 100644 --- a/lib-src/mod-null/ModNullCallback.cpp +++ b/lib-src/mod-null/ModNullCallback.cpp @@ -27,10 +27,41 @@ click from the menu into the actaul function to be called. #include #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 +# 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; diff --git a/lib-src/mod-null/ModNullCallback.h b/lib-src/mod-null/ModNullCallback.h index 42b24e206..82da774f9 100644 --- a/lib-src/mod-null/ModNullCallback.h +++ b/lib-src/mod-null/ModNullCallback.h @@ -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 - diff --git a/lib-src/mod-null/mod-null.vcxproj b/lib-src/mod-null/mod-null.vcxproj index e1df946fe..cc047d17d 100755 --- a/lib-src/mod-null/mod-null.vcxproj +++ b/lib-src/mod-null/mod-null.vcxproj @@ -54,7 +54,7 @@ Disabled $(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) - BUILDING_MOD_NULL;WXUSINGDLL;__WXMSW__;__WXDEBUG__;WIN32;_DEBUG;_USRDLL;%(PreprocessorDefinitions) + WXUSINGDLL;__WXMSW__;__WXDEBUG__;_DEBUG;WIN32;STRICT;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL @@ -78,7 +78,7 @@ MaxSpeed true $(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) - BUILDING_MOD_NULL;WXUSINGDLL;__WXMSW__;WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + wxDEBUG_LEVEL=0;WXUSINGDLL;__WXMSW__;WIN32;NDEBUG;STRICT;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreadedDLL true @@ -86,13 +86,14 @@ audacity.lib;%(AdditionalDependencies) - $(OutDir)modules\$(ProjectName).dll - $(WXWIN)\lib\vc_dll;$(OutDir);%(AdditionalLibraryDirectories) + ..\..\win\$(ConfigurationName)\modules\$(ProjectName).dll + ../../win/$(Configuration);$(WXWIN)\lib\vc_dll;%(AdditionalLibraryDirectories) true Windows true true MachineX86 + false