From 98fec31a3e3910743460328684bf18ee3e3c0dd1 Mon Sep 17 00:00:00 2001 From: "james.k.crook@gmail.com" Date: Sun, 24 Apr 2011 16:02:10 +0000 Subject: [PATCH] Added missing header declarations for AudacityProjectCommandFunctor. --- src/Menus.cpp | 73 ++++++++++++++++++++++----------------------------- src/Project.h | 23 ++++++++++++++++ 2 files changed, 54 insertions(+), 42 deletions(-) diff --git a/src/Menus.cpp b/src/Menus.cpp index 31e369978..a4f44d3e5 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -130,54 +130,43 @@ enum { kAlign }; -typedef void (AudacityProject::*audCommandFunction)(); -typedef void (AudacityProject::*audCommandListFunction)(int); -class AudacityProjectCommandFunctor:public CommandFunctor +AudacityProjectCommandFunctor::AudacityProjectCommandFunctor(AudacityProject *project, + audCommandFunction commandFunction) { -public: - AudacityProjectCommandFunctor(AudacityProject *project, - audCommandFunction commandFunction) - { - mProject = project; - mCommandFunction = commandFunction; - mCommandListFunction = NULL; - } + mProject = project; + mCommandFunction = commandFunction; + mCommandListFunction = NULL; +} - AudacityProjectCommandFunctor(AudacityProject *project, - audCommandListFunction commandFunction) - { - mProject = project; - mCommandFunction = NULL; - mCommandListFunction = commandFunction; - } +AudacityProjectCommandFunctor::AudacityProjectCommandFunctor(AudacityProject *project, + audCommandListFunction commandFunction) +{ + mProject = project; + mCommandFunction = NULL; + mCommandListFunction = commandFunction; +} - AudacityProjectCommandFunctor(AudacityProject *project, - audCommandListFunction commandFunction, - wxArrayInt explicitIndices) - { - mProject = project; - mCommandFunction = NULL; - mCommandListFunction = commandFunction; - mExplicitIndices = explicitIndices; - } +AudacityProjectCommandFunctor::AudacityProjectCommandFunctor(AudacityProject *project, + audCommandListFunction commandFunction, + wxArrayInt explicitIndices) +{ + mProject = project; + mCommandFunction = NULL; + mCommandListFunction = commandFunction; + mExplicitIndices = explicitIndices; +} - virtual void operator()(int index = 0) - { - if (mCommandListFunction && mExplicitIndices.GetCount() > 0) - (mProject->*(mCommandListFunction)) (mExplicitIndices[index]); - else if (mCommandListFunction) - (mProject->*(mCommandListFunction)) (index); - else - (mProject->*(mCommandFunction)) (); - } +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) diff --git a/src/Project.h b/src/Project.h index 4edeb0bdc..1f1214845 100644 --- a/src/Project.h +++ b/src/Project.h @@ -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