1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-15 09:01:12 +01:00

Shrink the command functor objects by using more subclasses...

... Let virtual function dispatch do the work, don't write our own dispatch!
This commit is contained in:
Paul Licameli
2016-02-24 15:17:06 -05:00
parent 09b4dfc5a2
commit 0c182c3c0b
3 changed files with 60 additions and 80 deletions

View File

@@ -685,36 +685,5 @@ public:
DECLARE_EVENT_TABLE()
};
typedef void (AudacityProject::*audCommandFunction)();
typedef void (AudacityProject::*audCommandKeyFunction)(const wxEvent *);
typedef void (AudacityProject::*audCommandListFunction)(int);
typedef bool (AudacityProject::*audCommandPluginFunction)(const PluginID &, int);
// Previously this was in menus.cpp, and the declaration of the
// command functor was not visible anywhere else.
class AUDACITY_DLL_API AudacityProjectCommandFunctor : public CommandFunctor
{
public:
AudacityProjectCommandFunctor(AudacityProject *project,
audCommandFunction commandFunction);
AudacityProjectCommandFunctor(AudacityProject *project,
audCommandKeyFunction commandFunction);
AudacityProjectCommandFunctor(AudacityProject *project,
audCommandListFunction commandFunction);
AudacityProjectCommandFunctor(AudacityProject *project,
audCommandPluginFunction commandFunction,
const PluginID & pluginID);
virtual void operator()(int index = 0, const wxEvent *evt = NULL);
private:
AudacityProject *mProject;
audCommandFunction mCommandFunction;
audCommandKeyFunction mCommandKeyFunction;
audCommandListFunction mCommandListFunction;
audCommandPluginFunction mCommandPluginFunction;
PluginID mPluginID;
};
#endif