1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-18 17:10:55 +02:00

Added missing header declarations for AudacityProjectCommandFunctor.

This commit is contained in:
james.k.crook@gmail.com 2011-04-24 16:02:10 +00:00
parent 21851193de
commit 98fec31a3e
2 changed files with 54 additions and 42 deletions

View File

@ -130,54 +130,43 @@ enum {
kAlign
};
typedef void (AudacityProject::*audCommandFunction)();
typedef void (AudacityProject::*audCommandListFunction)(int);
class AudacityProjectCommandFunctor:public CommandFunctor
{
public:
AudacityProjectCommandFunctor(AudacityProject *project,
AudacityProjectCommandFunctor::AudacityProjectCommandFunctor(AudacityProject *project,
audCommandFunction commandFunction)
{
{
mProject = project;
mCommandFunction = commandFunction;
mCommandListFunction = NULL;
}
}
AudacityProjectCommandFunctor(AudacityProject *project,
AudacityProjectCommandFunctor::AudacityProjectCommandFunctor(AudacityProject *project,
audCommandListFunction commandFunction)
{
{
mProject = project;
mCommandFunction = NULL;
mCommandListFunction = commandFunction;
}
}
AudacityProjectCommandFunctor(AudacityProject *project,
AudacityProjectCommandFunctor::AudacityProjectCommandFunctor(AudacityProject *project,
audCommandListFunction commandFunction,
wxArrayInt explicitIndices)
{
{
mProject = project;
mCommandFunction = NULL;
mCommandListFunction = commandFunction;
mExplicitIndices = explicitIndices;
}
}
virtual void operator()(int index = 0)
{
void AudacityProjectCommandFunctor::operator()(int index )
{
if (mCommandListFunction && mExplicitIndices.GetCount() > 0)
(mProject->*(mCommandListFunction)) (mExplicitIndices[index]);
else if (mCommandListFunction)
(mProject->*(mCommandListFunction)) (index);
else
(mProject->*(mCommandFunction)) ();
}
}
private:
AudacityProject *mProject;
audCommandFunction mCommandFunction;
audCommandListFunction mCommandListFunction;
wxArrayInt mExplicitIndices;
};
#define FN(X) new AudacityProjectCommandFunctor(this, &AudacityProject:: X )
#define FNI(X, I) new AudacityProjectCommandFunctor(this, &AudacityProject:: X, I)

View File

@ -571,5 +571,28 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
DECLARE_EVENT_TABLE()
};
typedef void (AudacityProject::*audCommandFunction)();
typedef void (AudacityProject::*audCommandListFunction)(int);
// Previously this was in menus.cpp, and the declaration of the
// command functor was not visible anywhere else.
class AudacityProjectCommandFunctor : public CommandFunctor
{
public:
AudacityProjectCommandFunctor(AudacityProject *project,
audCommandFunction commandFunction);
AudacityProjectCommandFunctor(AudacityProject *project,
audCommandListFunction commandFunction);
AudacityProjectCommandFunctor(AudacityProject *project,
audCommandListFunction commandFunction,
wxArrayInt explicitIndices);
virtual void operator()(int index = 0);
private:
AudacityProject *mProject;
audCommandFunction mCommandFunction;
audCommandListFunction mCommandListFunction;
wxArrayInt mExplicitIndices;
};
#endif