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
Registry
{
class
Visitor
; }
36
37
class
AUDACITY_DLL_API
MenuCreator
38
{
39
public
:
40
MenuCreator
();
41
~MenuCreator
();
42
void
CreateMenusAndCommands(
AudacityProject
&project);
43
void
RebuildMenuBar(
AudacityProject
&project);
44
45
static
void
RebuildAllMenuBars();
46
47
public
:
48
CommandFlag
mLastFlags
;
49
50
// Last effect applied to this project
51
PluginID
mLastGenerator{};
52
PluginID
mLastEffect{};
53
PluginID
mLastAnalyzer{};
54
int
mLastAnalyzerRegistration
;
55
int
mLastAnalyzerRegisteredId
;
56
PluginID
mLastTool{};
57
int
mLastToolRegistration
;
58
int
mLastToolRegisteredId
;
59
enum
{
60
repeattypenone = 0,
61
repeattypeplugin = 1,
62
repeattypeunique = 2,
63
repeattypeapplymacro = 3
64
};
65
unsigned
mRepeatGeneratorFlags
;
66
unsigned
mRepeatEffectFlags
;
67
unsigned
mRepeatAnalyzerFlags
;
68
unsigned
mRepeatToolFlags
;
69
};
70
71
struct
ToolbarMenuVisitor
;
72
74
struct
MenuUpdateMessage
{};
75
76
class
AUDACITY_DLL_API
MenuManager
final
77
:
public
MenuCreator
78
,
public
ClientData::Base
79
,
public
Observer::Publisher
<MenuUpdateMessage>
80
,
private
PrefsListener
81
{
82
public
:
83
84
static
MenuManager
&
Get
(
AudacityProject
&project );
85
static
const
MenuManager
&
Get
(
const
AudacityProject
&project );
86
87
explicit
88
MenuManager
(
AudacityProject
&project );
89
MenuManager
(
const
MenuManager
& ) PROHIBITED;
90
MenuManager
&
operator=
(
const
MenuManager
& ) PROHIBITED;
91
~MenuManager
();
92
93
static
void
Visit
(
ToolbarMenuVisitor
&visitor );
94
95
static
void
ModifyUndoMenuItems(
AudacityProject
&project);
96
97
// checkActive is a temporary hack that should be removed as soon as we
98
// get multiple effect preview working
99
void
UpdateMenus(
bool
checkActive =
true
);
100
101
// If checkActive, do not do complete flags testing on an
102
// inactive project as it is needlessly expensive.
103
CommandFlag
GetUpdateFlags(
bool
checkActive =
false
)
const
;
104
void
UpdatePrefs
()
override
;
105
106
// Command Handling
107
bool
ReportIfActionNotAllowed(
108
const
TranslatableString
& Name,
CommandFlag
& flags,
CommandFlag
flagsRqd );
109
bool
TryToMakeActionAllowed(
110
CommandFlag
& flags,
CommandFlag
flagsRqd );
111
112
113
private
:
114
void
TellUserWhyDisallowed(
const
TranslatableString
& Name,
CommandFlag
flagsGot,
115
CommandFlag
flagsRequired);
116
117
void
OnUndoRedo(
struct
UndoRedoMessage
);
118
119
Observer::Subscription
mUndoSubscription
;
120
AudacityProject
&
mProject
;
121
122
public
:
123
// 0 is grey out, 1 is Autoselect, 2 is Give warnings.
124
int
mWhatIfNoSelection
;
125
bool
mStopIfWasPaused
;
126
};
127
128
#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
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:38
MenuCreator::mLastAnalyzerRegisteredId
int mLastAnalyzerRegisteredId
Definition:
Menus.h:55
MenuCreator::mLastFlags
CommandFlag mLastFlags
Definition:
Menus.h:48
MenuCreator::mRepeatAnalyzerFlags
unsigned mRepeatAnalyzerFlags
Definition:
Menus.h:67
MenuCreator::mRepeatEffectFlags
unsigned mRepeatEffectFlags
Definition:
Menus.h:66
MenuCreator::mRepeatGeneratorFlags
unsigned mRepeatGeneratorFlags
Definition:
Menus.h:65
MenuCreator::mLastToolRegistration
int mLastToolRegistration
Definition:
Menus.h:57
MenuCreator::mRepeatToolFlags
unsigned mRepeatToolFlags
Definition:
Menus.h:68
MenuCreator::mLastAnalyzerRegistration
int mLastAnalyzerRegistration
Definition:
Menus.h:54
MenuCreator::mLastToolRegisteredId
int mLastToolRegisteredId
Definition:
Menus.h:58
MenuManager
MenuManager handles updates to menu state.
Definition:
Menus.h:81
MenuManager::mWhatIfNoSelection
int mWhatIfNoSelection
Definition:
Menus.h:124
MenuManager::MenuManager
MenuManager(const MenuManager &) PROHIBITED
MenuManager::operator=
MenuManager & operator=(const MenuManager &) PROHIBITED
MenuManager::mStopIfWasPaused
bool mStopIfWasPaused
Definition:
Menus.h:125
MenuManager::mUndoSubscription
Observer::Subscription mUndoSubscription
Definition:
Menus.h:119
MenuManager::mProject
AudacityProject & mProject
Definition:
Menus.h:120
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:556
Registry::Visitor
Definition:
Registry.h:256
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition:
Track.h:162
TrackList
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition:
Track.h:1212
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
Registry
Definition:
Menus.h:35
Registry::Visit
void Visit(Visitor &visitor, BaseItem *pTopItem, const GroupItemBase *pRegistry)
Definition:
Registry.cpp:737
TrackInfo::UpdatePrefs
AUDACITY_DLL_API void UpdatePrefs(wxWindow *pParent)
ClientData::Base
A convenient default parameter for class template Site.
Definition:
ClientData.h:28
MenuUpdateMessage
Sent when menus update (such as for changing enablement of items)
Definition:
Menus.h:74
ToolbarMenuVisitor
Definition:
CommandManager.h:413
UndoRedoMessage
Type of message published by UndoManager.
Definition:
UndoManager.h:55
Generated by
1.9.3