Audacity
3.2.0
src
Menus.h
Go to the documentation of this file.
1
/**********************************************************************
2
3
Audacity: A Digital Audio Editor
4
5
Menus.h
6
7
Dominic Mazzoni
8
9
**********************************************************************/
10
#ifndef __AUDACITY_MENUS__
11
#define __AUDACITY_MENUS__
12
13
#include "
Identifier.h
"
14
15
#include "
Prefs.h
"
16
#include "
ClientData.h
"
17
#include "
commands/CommandFlag.h
"
18
#include "
Observer.h
"
19
20
class
wxArrayString;
21
class
wxCommandEvent;
22
class
AudacityProject
;
23
class
CommandContext
;
24
class
CommandManager
;
25
class
Track
;
26
class
TrackList
;
27
class
ViewInfo
;
28
29
enum
EffectType
: int;
30
31
typedef
wxString
PluginID
;
32
typedef
wxString
MacroID
;
33
typedef
wxArrayString
PluginIDs
;
34
35
namespace
MenuTable
{
36
struct
Traits;
37
template
<
typename
MenuTraits>
struct
Visitor;
38
}
39
40
class
AUDACITY_DLL_API
MenuCreator
41
{
42
public
:
43
MenuCreator
();
44
~MenuCreator
();
45
void
CreateMenusAndCommands(
AudacityProject
&
project
);
46
void
RebuildMenuBar(
AudacityProject
&
project
);
47
48
static
void
RebuildAllMenuBars();
49
50
public
:
51
CommandFlag
mLastFlags
;
52
53
// Last effect applied to this project
54
PluginID
mLastGenerator{};
55
PluginID
mLastEffect{};
56
PluginID
mLastAnalyzer{};
57
int
mLastAnalyzerRegistration
;
58
int
mLastAnalyzerRegisteredId
;
59
PluginID
mLastTool{};
60
int
mLastToolRegistration
;
61
int
mLastToolRegisteredId
;
62
enum
{
63
repeattypenone = 0,
64
repeattypeplugin = 1,
65
repeattypeunique = 2,
66
repeattypeapplymacro = 3
67
};
68
unsigned
mRepeatGeneratorFlags
;
69
unsigned
mRepeatEffectFlags
;
70
unsigned
mRepeatAnalyzerFlags
;
71
unsigned
mRepeatToolFlags
;
72
};
73
75
struct
MenuUpdateMessage
{};
76
77
class
AUDACITY_DLL_API
MenuManager
final
78
:
public
MenuCreator
79
,
public
ClientData::Base
80
,
public
Observer::Publisher
<MenuUpdateMessage>
81
,
private
PrefsListener
82
{
83
public
:
84
85
static
MenuManager
&
Get
(
AudacityProject
&
project
);
86
static
const
MenuManager
&
Get
(
const
AudacityProject
&
project
);
87
88
explicit
89
MenuManager
(
AudacityProject
&
project
);
90
MenuManager
(
const
MenuManager
& ) =
delete
;
91
MenuManager
&
operator=
(
const
MenuManager
& ) =
delete
;
92
~MenuManager
();
93
94
static
void
Visit
(
95
MenuTable::Visitor<MenuTable::Traits>
&visitor,
AudacityProject
&
project
);
96
97
static
void
ModifyUndoMenuItems(
AudacityProject
&
project
);
98
99
// checkActive is a temporary hack that should be removed as soon as we
100
// get multiple effect preview working
101
void
UpdateMenus(
bool
checkActive =
true
);
102
103
// If checkActive, do not do complete flags testing on an
104
// inactive project as it is needlessly expensive.
105
CommandFlag
GetUpdateFlags(
bool
checkActive =
false
)
const
;
106
void
UpdatePrefs
()
override
;
107
108
// Command Handling
109
bool
ReportIfActionNotAllowed(
110
const
TranslatableString
& Name,
CommandFlag
& flags,
CommandFlag
flagsRqd );
111
bool
TryToMakeActionAllowed(
112
CommandFlag
& flags,
CommandFlag
flagsRqd );
113
114
115
private
:
116
void
TellUserWhyDisallowed(
const
TranslatableString
& Name,
CommandFlag
flagsGot,
117
CommandFlag
flagsRequired);
118
119
void
OnUndoRedo(
struct
UndoRedoMessage
);
120
121
Observer::Subscription
mUndoSubscription
;
122
AudacityProject
&
mProject
;
123
124
public
:
125
// 0 is grey out, 1 is Autoselect, 2 is Give warnings.
126
int
mWhatIfNoSelection
;
127
bool
mStopIfWasPaused
;
128
};
129
130
#endif
ClientData.h
Utility ClientData::Site to register hooks into a host class that attach client data.
CommandFlag.h
CommandFlag
std::bitset< NCommandFlags > CommandFlag
Definition:
CommandFlag.h:30
EffectType
EffectType
Definition:
EffectInterface.h:63
PluginID
wxString PluginID
Definition:
EffectManager.h:30
Identifier.h
MacroID
wxString MacroID
Definition:
Menus.h:32
PluginIDs
wxArrayString PluginIDs
Definition:
Menus.h:33
PluginID
wxString PluginID
Definition:
Menus.h:31
Observer.h
Prefs.h
project
const auto project
Definition:
TestWaveTrackMaker.cpp:18
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:34
CommandManager
CommandManager implements a system for organizing all user-callable commands.
Definition:
CommandManager.h:63
MenuCreator
MenuCreator is responsible for creating the main menu bar.
Definition:
Menus.h:41
MenuCreator::mLastAnalyzerRegisteredId
int mLastAnalyzerRegisteredId
Definition:
Menus.h:58
MenuCreator::mLastFlags
CommandFlag mLastFlags
Definition:
Menus.h:51
MenuCreator::mRepeatAnalyzerFlags
unsigned mRepeatAnalyzerFlags
Definition:
Menus.h:70
MenuCreator::mRepeatEffectFlags
unsigned mRepeatEffectFlags
Definition:
Menus.h:69
MenuCreator::mRepeatGeneratorFlags
unsigned mRepeatGeneratorFlags
Definition:
Menus.h:68
MenuCreator::mLastToolRegistration
int mLastToolRegistration
Definition:
Menus.h:60
MenuCreator::mRepeatToolFlags
unsigned mRepeatToolFlags
Definition:
Menus.h:71
MenuCreator::mLastAnalyzerRegistration
int mLastAnalyzerRegistration
Definition:
Menus.h:57
MenuCreator::mLastToolRegisteredId
int mLastToolRegisteredId
Definition:
Menus.h:61
MenuManager
MenuManager handles updates to menu state.
Definition:
Menus.h:82
MenuManager::mWhatIfNoSelection
int mWhatIfNoSelection
Definition:
Menus.h:126
MenuManager::operator=
MenuManager & operator=(const MenuManager &)=delete
MenuManager::MenuManager
MenuManager(const MenuManager &)=delete
MenuManager::mStopIfWasPaused
bool mStopIfWasPaused
Definition:
Menus.h:127
MenuManager::mUndoSubscription
Observer::Subscription mUndoSubscription
Definition:
Menus.h:121
MenuManager::mProject
AudacityProject & mProject
Definition:
Menus.h:122
Observer::Publisher
An object that sends messages to an open-ended list of subscribed callbacks.
Definition:
Observer.h:108
Observer::Subscription
A move-only handle representing a connection to a Publisher.
Definition:
Observer.h:70
PrefsListener
A listener notified of changes in preferences.
Definition:
Prefs.h:561
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition:
Track.h:123
TrackList
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition:
Track.h:987
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition:
TranslatableString.h:32
ViewInfo
Definition:
ViewInfo.h:192
BasicUI::Get
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition:
BasicUI.cpp:196
MenuTable
Definition:
CommandManager.h:392
Registry::detail::Visit
REGISTRIES_API void Visit(VisitorBase &visitor, const GroupItemBase *pTopItem, const GroupItemBase *pRegistry, void *pComputedItemContext)
Definition:
Registry.cpp:725
TrackInfo::UpdatePrefs
AUDACITY_DLL_API void UpdatePrefs(wxWindow *pParent)
ClientData::Base
A convenient default parameter for class template Site.
Definition:
ClientData.h:28
MenuTable::Visitor
Definition:
CommandManager.h:426
MenuUpdateMessage
Sent when menus update (such as for changing enablement of items)
Definition:
Menus.h:75
UndoRedoMessage
Type of message published by UndoManager.
Definition:
UndoManager.h:55
Generated by
1.9.3