mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-02 00:29:41 +02:00
... which called ::GetActiveProject(), but one purpose of the CommandContext class was to eliminate many uses of that global function, because a CommandContext must always be constructed from a reference to a project (which was always in fact the active one), then passed around to where it is needed! Also, just use the project member directly -- because CommandContext was intended as just a P.O.D (plain-old-data) structure. This also eliminates a dependency of CommandContext.cpp on Project.cpp. This is not enough by itself to break any dependency cycles.
42 lines
1009 B
C++
42 lines
1009 B
C++
/**********************************************************************
|
|
|
|
Audacity - A Digital Audio Editor
|
|
Copyright 1999-2009 Audacity Team
|
|
File License: wxWidgets
|
|
|
|
Dan Horgan
|
|
|
|
******************************************************************//**
|
|
|
|
\file CommandHandler.h
|
|
\brief Contains declarations for the CommandHandler class.
|
|
|
|
*//******************************************************************/
|
|
|
|
#ifndef __COMMANDHANDLER__
|
|
#define __COMMANDHANDLER__
|
|
|
|
#include "../MemoryX.h"
|
|
class AudacityApp;
|
|
class AudacityProject;
|
|
class AppCommandEvent;
|
|
class CommandContext;
|
|
|
|
class CommandHandler
|
|
{
|
|
private:
|
|
std::unique_ptr<const CommandContext> mCurrentContext;
|
|
|
|
public:
|
|
CommandHandler();
|
|
~CommandHandler();
|
|
|
|
// This should only be used during initialization
|
|
void SetProject(AudacityProject *proj);
|
|
|
|
// Whenever a command is received, process it.
|
|
void OnReceiveCommand(AppCommandEvent &event);
|
|
};
|
|
|
|
#endif /* End of include guard: __COMMANDHANDLER__ */
|