1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-05 22:28:57 +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) {
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
// member functions of AudacityProject (or other class!)
template<typename THIS>
using audCommandFunction = void (THIS::*)();
template<typename OBJ>
using audCommandFunction = void (OBJ::*)();
template<typename THIS>
template<typename OBJ>
class VoidFunctor final : public CommandFunctor
{
public:
explicit VoidFunctor(THIS *This, audCommandFunction<THIS> pfn)
explicit VoidFunctor(OBJ *This, audCommandFunction<OBJ> pfn)
: mThis{ This }, mCommandFunction{ pfn } {}
void operator () (int, const wxEvent *) override
{ (mThis->*mCommandFunction) (); }
private:
THIS *const mThis;
const audCommandFunction<THIS> mCommandFunction;
OBJ *const mThis;
const audCommandFunction<OBJ> mCommandFunction;
};
template<typename THIS>
using audCommandKeyFunction = void (THIS::*)(const wxEvent *);
template<typename OBJ>
using audCommandKeyFunction = void (OBJ::*)(const wxEvent *);
template<typename THIS>
template<typename OBJ>
class KeyFunctor final : public CommandFunctor
{
public:
explicit KeyFunctor(THIS *This, audCommandKeyFunction<THIS> pfn)
explicit KeyFunctor(OBJ *This, audCommandKeyFunction<OBJ> pfn)
: mThis{ This }, mCommandKeyFunction{ pfn } {}
void operator () (int, const wxEvent *evt) override
{ (mThis->*mCommandKeyFunction) (evt); }
private:
THIS *const mThis;
const audCommandKeyFunction<THIS> mCommandKeyFunction;
OBJ *const mThis;
const audCommandKeyFunction<OBJ> mCommandKeyFunction;
};
template<typename THIS>
using audCommandListFunction = void (THIS::*)(int);
template<typename OBJ>
using audCommandListFunction = void (OBJ::*)(int);
template<typename THIS>
template<typename OBJ>
class ListFunctor final : public CommandFunctor
{
public:
explicit ListFunctor(THIS *This, audCommandListFunction<THIS> pfn)
explicit ListFunctor(OBJ *This, audCommandListFunction<OBJ> pfn)
: mThis{ This }, mCommandListFunction{ pfn } {}
void operator () (int index, const wxEvent *) override
{ (mThis->*mCommandListFunction)(index); }
private:
THIS *const mThis;
const audCommandListFunction<THIS> mCommandListFunction;
OBJ *const mThis;
const audCommandListFunction<OBJ> mCommandListFunction;
};
template<typename THIS>
using audCommandPluginFunction = bool (THIS::*)(const PluginID &, int);
template<typename OBJ>
using audCommandPluginFunction = bool (OBJ::*)(const PluginID &, int);
template<typename THIS>
template<typename OBJ>
class PluginFunctor final : public CommandFunctor
{
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 } {}
void operator () (int, const wxEvent *) override
{ (mThis->*mCommandPluginFunction)
@ -93,34 +93,34 @@ public:
); }
private:
const PluginID mPluginID;
THIS *const mThis;
const audCommandPluginFunction<THIS> mCommandPluginFunction;
OBJ *const mThis;
const audCommandPluginFunction<OBJ> mCommandPluginFunction;
};
// Now define an overloaded factory function
template<typename THIS>
inline CommandFunctorPointer MakeFunctor(THIS *This,
audCommandFunction<THIS> pfn)
{ return CommandFunctorPointer{ safenew VoidFunctor<THIS>{ This, pfn } }; }
template<typename OBJ>
inline CommandFunctorPointer MakeFunctor(OBJ *This,
audCommandFunction<OBJ> pfn)
{ return CommandFunctorPointer{ safenew VoidFunctor<OBJ>{ This, pfn } }; }
template<typename THIS>
inline CommandFunctorPointer MakeFunctor(THIS *This,
audCommandKeyFunction<THIS> pfn)
{ return CommandFunctorPointer{ safenew KeyFunctor<THIS>{ This, pfn } }; }
template<typename OBJ>
inline CommandFunctorPointer MakeFunctor(OBJ *This,
audCommandKeyFunction<OBJ> pfn)
{ return CommandFunctorPointer{ safenew KeyFunctor<OBJ>{ This, pfn } }; }
template<typename THIS>
inline CommandFunctorPointer MakeFunctor(THIS *This,
audCommandListFunction<THIS> pfn)
{ return CommandFunctorPointer{ safenew ListFunctor<THIS>{ This, pfn } }; }
template<typename OBJ>
inline CommandFunctorPointer MakeFunctor(OBJ *This,
audCommandListFunction<OBJ> pfn)
{ return CommandFunctorPointer{ safenew ListFunctor<OBJ>{ This, pfn } }; }
template<typename THIS>
inline CommandFunctorPointer MakeFunctor(THIS *This, const PluginID &id,
audCommandPluginFunction<THIS> pfn)
{ return CommandFunctorPointer{ safenew PluginFunctor<THIS>{ This, id, pfn } }; }
template<typename OBJ>
inline CommandFunctorPointer MakeFunctor(OBJ *This, const PluginID &id,
audCommandPluginFunction<OBJ> pfn)
{ return CommandFunctorPointer{ safenew PluginFunctor<OBJ>{ This, id, pfn } }; }
// Now define the macro abbreviations that call the factory
#define FNT(THIS, This, X) (MakeFunctor<THIS>(This, X ))
#define FNTS(THIS, This, X, S) (MakeFunctor<THIS>(This, (S), X ))
#define FNT(OBJ, This, X) (MakeFunctor<OBJ>(This, X ))
#define FNTS(OBJ, This, X, S) (MakeFunctor<OBJ>(This, (S), X ))
#define FN(X) FNT(AudacityProject, this, & AudacityProject :: X)
#define FNS(X, S) FNTS(AudacityProject, this, & AudacityProject :: X, S)