1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-11 14:41:06 +02:00

Windows build fixes

This commit is contained in:
Paul Licameli 2016-04-24 01:12:42 -04:00
parent 89e33da072
commit bc80ffe766
2 changed files with 44 additions and 43 deletions

View File

@ -285,7 +285,8 @@ public:
{ {
} }
bool IsSupportedFormat(const wxDataFormat & format, Direction WXUNUSED(dir = Get)) const override bool IsSupportedFormat(const wxDataFormat & format, Direction WXUNUSED(dir = Get)) const
// PRL: This function does NOT override any inherited virtual! What does it do?
{ {
if (format.GetType() == wxDF_FILENAME) { if (format.GetType() == wxDF_FILENAME) {
return true; return true;

View File

@ -29,62 +29,62 @@ using CommandFunctorPointer = std::shared_ptr <CommandFunctor>;
// Define functor subclasses that dispatch to the correct call sequence on // Define functor subclasses that dispatch to the correct call sequence on
// member functions of AudacityProject (or other class!) // member functions of AudacityProject (or other class!)
template<typename THIS> template<typename OBJ>
using audCommandFunction = void (THIS::*)(); using audCommandFunction = void (OBJ::*)();
template<typename THIS> template<typename OBJ>
class VoidFunctor final : public CommandFunctor class VoidFunctor final : public CommandFunctor
{ {
public: public:
explicit VoidFunctor(THIS *This, audCommandFunction<THIS> pfn) explicit VoidFunctor(OBJ *This, audCommandFunction<OBJ> pfn)
: mThis{ This }, mCommandFunction{ pfn } {} : mThis{ This }, mCommandFunction{ pfn } {}
void operator () (int, const wxEvent *) override void operator () (int, const wxEvent *) override
{ (mThis->*mCommandFunction) (); } { (mThis->*mCommandFunction) (); }
private: private:
THIS *const mThis; OBJ *const mThis;
const audCommandFunction<THIS> mCommandFunction; const audCommandFunction<OBJ> mCommandFunction;
}; };
template<typename THIS> template<typename OBJ>
using audCommandKeyFunction = void (THIS::*)(const wxEvent *); using audCommandKeyFunction = void (OBJ::*)(const wxEvent *);
template<typename THIS> template<typename OBJ>
class KeyFunctor final : public CommandFunctor class KeyFunctor final : public CommandFunctor
{ {
public: public:
explicit KeyFunctor(THIS *This, audCommandKeyFunction<THIS> pfn) explicit KeyFunctor(OBJ *This, audCommandKeyFunction<OBJ> pfn)
: mThis{ This }, mCommandKeyFunction{ pfn } {} : mThis{ This }, mCommandKeyFunction{ pfn } {}
void operator () (int, const wxEvent *evt) override void operator () (int, const wxEvent *evt) override
{ (mThis->*mCommandKeyFunction) (evt); } { (mThis->*mCommandKeyFunction) (evt); }
private: private:
THIS *const mThis; OBJ *const mThis;
const audCommandKeyFunction<THIS> mCommandKeyFunction; const audCommandKeyFunction<OBJ> mCommandKeyFunction;
}; };
template<typename THIS> template<typename OBJ>
using audCommandListFunction = void (THIS::*)(int); using audCommandListFunction = void (OBJ::*)(int);
template<typename THIS> template<typename OBJ>
class ListFunctor final : public CommandFunctor class ListFunctor final : public CommandFunctor
{ {
public: public:
explicit ListFunctor(THIS *This, audCommandListFunction<THIS> pfn) explicit ListFunctor(OBJ *This, audCommandListFunction<OBJ> pfn)
: mThis{ This }, mCommandListFunction{ pfn } {} : mThis{ This }, mCommandListFunction{ pfn } {}
void operator () (int index, const wxEvent *) override void operator () (int index, const wxEvent *) override
{ (mThis->*mCommandListFunction)(index); } { (mThis->*mCommandListFunction)(index); }
private: private:
THIS *const mThis; OBJ *const mThis;
const audCommandListFunction<THIS> mCommandListFunction; const audCommandListFunction<OBJ> mCommandListFunction;
}; };
template<typename THIS> template<typename OBJ>
using audCommandPluginFunction = bool (THIS::*)(const PluginID &, int); using audCommandPluginFunction = bool (OBJ::*)(const PluginID &, int);
template<typename THIS> template<typename OBJ>
class PluginFunctor final : public CommandFunctor class PluginFunctor final : public CommandFunctor
{ {
public: public:
explicit PluginFunctor(THIS *This, const PluginID &id, audCommandPluginFunction<THIS> pfn) explicit PluginFunctor(OBJ *This, const PluginID &id, audCommandPluginFunction<OBJ> pfn)
: mPluginID{ id }, mThis{ This }, mCommandPluginFunction{ pfn } {} : mPluginID{ id }, mThis{ This }, mCommandPluginFunction{ pfn } {}
void operator () (int, const wxEvent *) override void operator () (int, const wxEvent *) override
{ (mThis->*mCommandPluginFunction) { (mThis->*mCommandPluginFunction)
@ -93,34 +93,34 @@ public:
); } ); }
private: private:
const PluginID mPluginID; const PluginID mPluginID;
THIS *const mThis; OBJ *const mThis;
const audCommandPluginFunction<THIS> mCommandPluginFunction; const audCommandPluginFunction<OBJ> mCommandPluginFunction;
}; };
// Now define an overloaded factory function // Now define an overloaded factory function
template<typename THIS> template<typename OBJ>
inline CommandFunctorPointer MakeFunctor(THIS *This, inline CommandFunctorPointer MakeFunctor(OBJ *This,
audCommandFunction<THIS> pfn) audCommandFunction<OBJ> pfn)
{ return CommandFunctorPointer{ safenew VoidFunctor<THIS>{ This, pfn } }; } { return CommandFunctorPointer{ safenew VoidFunctor<OBJ>{ This, pfn } }; }
template<typename THIS> template<typename OBJ>
inline CommandFunctorPointer MakeFunctor(THIS *This, inline CommandFunctorPointer MakeFunctor(OBJ *This,
audCommandKeyFunction<THIS> pfn) audCommandKeyFunction<OBJ> pfn)
{ return CommandFunctorPointer{ safenew KeyFunctor<THIS>{ This, pfn } }; } { return CommandFunctorPointer{ safenew KeyFunctor<OBJ>{ This, pfn } }; }
template<typename THIS> template<typename OBJ>
inline CommandFunctorPointer MakeFunctor(THIS *This, inline CommandFunctorPointer MakeFunctor(OBJ *This,
audCommandListFunction<THIS> pfn) audCommandListFunction<OBJ> pfn)
{ return CommandFunctorPointer{ safenew ListFunctor<THIS>{ This, pfn } }; } { return CommandFunctorPointer{ safenew ListFunctor<OBJ>{ This, pfn } }; }
template<typename THIS> template<typename OBJ>
inline CommandFunctorPointer MakeFunctor(THIS *This, const PluginID &id, inline CommandFunctorPointer MakeFunctor(OBJ *This, const PluginID &id,
audCommandPluginFunction<THIS> pfn) audCommandPluginFunction<OBJ> pfn)
{ return CommandFunctorPointer{ safenew PluginFunctor<THIS>{ This, id, pfn } }; } { return CommandFunctorPointer{ safenew PluginFunctor<OBJ>{ This, id, pfn } }; }
// Now define the macro abbreviations that call the factory // Now define the macro abbreviations that call the factory
#define FNT(THIS, This, X) (MakeFunctor<THIS>(This, X )) #define FNT(OBJ, This, X) (MakeFunctor<OBJ>(This, X ))
#define FNTS(THIS, This, X, S) (MakeFunctor<THIS>(This, (S), X )) #define FNTS(OBJ, This, X, S) (MakeFunctor<OBJ>(This, (S), X ))
#define FN(X) FNT(AudacityProject, this, & AudacityProject :: X) #define FN(X) FNT(AudacityProject, this, & AudacityProject :: X)
#define FNS(X, S) FNTS(AudacityProject, this, & AudacityProject :: X, S) #define FNS(X, S) FNTS(AudacityProject, this, & AudacityProject :: X, S)