Audacity  3.0.3
CommandContext.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  CommandContext.h
6 
7  Created by Paul Licameli on 4/22/16.
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_COMMAND_CONTEXT__
12 #define __AUDACITY_COMMAND_CONTEXT__
13 
14 #include <memory>
15 #include "Identifier.h"
16 
17 class AudacityProject;
18 class wxEvent;
21 
22 class SelectedRegion;
23 class Track;
24 
26  TemporarySelection() = default;
29 
31  Track *pTrack = nullptr;
32 };
33 
34 class AUDACITY_DLL_API CommandContext {
35 public:
38  , const wxEvent *e = nullptr
39  , int ii = 0
40  , const CommandParameter &param = CommandParameter{}
41  );
42 
44  AudacityProject &p,
45  std::unique_ptr<CommandOutputTargets> target);
46 
48 
49  virtual void Status( const wxString &message, bool bFlush = false ) const;
50  virtual void Error( const wxString &message ) const;
51  virtual void Progress( double d ) const;
52 
53  // Output formatting...
54  void StartArray() const;
55  void EndArray() const;
56  void StartStruct() const;
57  void EndStruct() const;
58  void StartField(const wxString &name) const;
59  void EndField() const;
60  void AddItem(const wxString &value , const wxString &name = {} ) const;
61  void AddBool(const bool value , const wxString &name = {} ) const;
62  void AddItem(const double value , const wxString &name = {} ) const;
63 
65  std::unique_ptr<CommandOutputTargets> pOutput;
66  const wxEvent *pEvt;
67  int index;
69 
70  // This might depend on a point picked with a context menu
72 };
73 #endif
TemporarySelection::pTrack
Track * pTrack
Definition: CommandContext.h:31
CommandContext::pEvt
const wxEvent * pEvt
Definition: CommandContext.h:66
TemporarySelection::TemporarySelection
TemporarySelection(const TemporarySelection &)=default
CommandContext
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
Definition: CommandContext.h:34
name
const TranslatableString name
Definition: Distortion.cpp:98
Identifier.h
TemporarySelection::TemporarySelection
TemporarySelection()=default
CommandContext::parameter
CommandParameter parameter
Definition: CommandContext.h:68
CommandID
TaggedIdentifier< CommandIdTag, false > CommandID
Identifies a menu command or macro. Case-insensitive comparison.
Definition: Identifier.h:232
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:239
TaggedIdentifier< CommandIdTag, false >
CommandContext::index
int index
Definition: CommandContext.h:67
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
TemporarySelection
Definition: CommandContext.h:25
TemporarySelection::operator=
TemporarySelection & operator=(const TemporarySelection &)=default
TemporarySelection::pSelectedRegion
SelectedRegion * pSelectedRegion
Definition: CommandContext.h:30
CommandContext::project
AudacityProject & project
Definition: CommandContext.h:64
CommandContext::~CommandContext
~CommandContext()
CommandOutputTargets
CommandOutputTargets a mix of three output classes to output progress indication, status messages and...
Definition: CommandTargets.h:306
CommandContext::temporarySelection
TemporarySelection temporarySelection
Definition: CommandContext.h:71
SelectedRegion
Defines a selected portion of a project.
Definition: SelectedRegion.h:35
CommandContext::pOutput
std::unique_ptr< CommandOutputTargets > pOutput
Definition: CommandContext.h:65