Audacity
3.2.0
libraries
lib-menus
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 "
Callable.h
"
16
#include "
CommandTargets.h
"
17
#include "
GlobalVariable.h
"
18
#include "
Identifier.h
"
19
20
class
AudacityProject
;
21
class
wxEvent;
22
class
CommandOutputTargets
;
23
using
CommandParameter
=
CommandID
;
24
25
class
SelectedRegion
;
26
class
Track
;
27
28
struct
TemporarySelection
{
29
TemporarySelection
() =
default
;
30
TemporarySelection
(
const
TemporarySelection
&) =
default
;
31
TemporarySelection
&
operator=
(
const
TemporarySelection
&) =
default
;
32
33
SelectedRegion
*
pSelectedRegion
=
nullptr
;
34
Track
*
pTrack
=
nullptr
;
35
};
36
37
class
MENUS_API
CommandContext
{
38
public
:
39
struct
MENUS_API
TargetFactory
:
DefaultedGlobalHook
< TargetFactory,
40
Callable::UniquePtrFactory<CommandOutputTargets>::Function
41
>{};
42
43
CommandContext
(
44
AudacityProject
&p
45
,
const
wxEvent *e =
nullptr
46
,
int
ii = 0
47
,
const
CommandParameter
¶m =
CommandParameter
{}
48
);
49
50
CommandContext
(
51
AudacityProject
&p,
52
std::unique_ptr<CommandOutputTargets> target);
53
54
~CommandContext
();
55
56
virtual
void
Status(
const
wxString &message,
bool
bFlush =
false
)
const
;
57
virtual
void
Error
(
const
wxString &message )
const
;
58
virtual
void
Progress(
double
d )
const
;
59
60
// Output formatting...
61
void
StartArray()
const
;
62
void
EndArray()
const
;
63
void
StartStruct()
const
;
64
void
EndStruct()
const
;
65
void
StartField(
const
wxString &
name
)
const
;
66
void
EndField()
const
;
67
void
AddItem(
const
wxString &value ,
const
wxString &
name
= {} )
const
;
68
void
AddBool(
const
bool
value ,
const
wxString &
name
= {} )
const
;
69
void
AddItem(
const
double
value ,
const
wxString &
name
= {} )
const
;
70
71
AudacityProject
&
project
;
72
std::unique_ptr<CommandOutputTargets>
pOutput
;
73
const
wxEvent *
pEvt
;
74
int
index
;
75
CommandParameter
parameter
;
76
77
// This might depend on a point picked with a context menu
78
TemporarySelection
temporarySelection
;
79
};
80
#endif
Callable.h
Functions and classes that generate callable objects.
CommandTargets.h
ExportResult::Error
@ Error
GlobalVariable.h
Identifier.h
CommandID
TaggedIdentifier< CommandIdTag, false > CommandID
Identifies a menu command or macro. Case-insensitive comparison.
Definition:
Identifier.h:232
name
wxString name
Definition:
TagsEditor.cpp:166
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition:
Project.h:90
CommandContext
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
Definition:
CommandContext.h:37
CommandContext::index
int index
Definition:
CommandContext.h:74
CommandContext::parameter
CommandParameter parameter
Definition:
CommandContext.h:75
CommandContext::pEvt
const wxEvent * pEvt
Definition:
CommandContext.h:73
CommandContext::temporarySelection
TemporarySelection temporarySelection
Definition:
CommandContext.h:78
CommandContext::~CommandContext
~CommandContext()
CommandContext::project
AudacityProject & project
Definition:
CommandContext.h:71
CommandContext::pOutput
std::unique_ptr< CommandOutputTargets > pOutput
Definition:
CommandContext.h:72
CommandOutputTargets
CommandOutputTargets a mix of three output classes to output progress indication, status messages and...
Definition:
CommandTargets.h:275
DefaultedGlobalHook
Definition:
GlobalVariable.h:209
SelectedRegion
Defines a selected portion of a project.
Definition:
SelectedRegion.h:38
TaggedIdentifier< CommandIdTag, false >
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition:
Track.h:110
CommandContext::TargetFactory
Definition:
CommandContext.h:41
TemporarySelection
Definition:
CommandContext.h:28
TemporarySelection::TemporarySelection
TemporarySelection()=default
TemporarySelection::pTrack
Track * pTrack
Definition:
CommandContext.h:34
TemporarySelection::pSelectedRegion
SelectedRegion * pSelectedRegion
Definition:
CommandContext.h:33
TemporarySelection::TemporarySelection
TemporarySelection(const TemporarySelection &)=default
TemporarySelection::operator=
TemporarySelection & operator=(const TemporarySelection &)=default
Generated by
1.9.3