12#ifndef __AUDACITY_COMMAND_MANAGER__
13#define __AUDACITY_COMMAND_MANAGER__
35#include <unordered_map>
62 Callable::SharedPtrFactory<CommandManager, AudacityProject &>::Function
71 bool(const CommandID&)
80 CommandFlag GetUpdateFlags(
bool quick =
false)
const;
84 bool ReportIfActionNotAllowed(
86 bool TryToMakeActionAllowed(
95 int mLastAnalyzerRegistration = repeattypenone;
96 int mLastAnalyzerRegisteredId = -1;
98 int mLastToolRegistration = repeattypenone;
99 int mLastToolRegisteredId = -1;
102 repeattypeplugin = 1,
103 repeattypeunique = 2,
104 repeattypeapplymacro = 3
106 unsigned mRepeatGeneratorFlags = 0;
107 unsigned mRepeatEffectFlags = 0;
108 unsigned mRepeatAnalyzerFlags = 0;
109 unsigned mRepeatToolFlags = 0;
115 bool mStopIfWasPaused{
true };
118 size_t NCommands()
const {
return mCommandList.size(); }
129 std::function<
void()> doSeparator);
145 virtual void BeginOccultCommands();
149 virtual void EndMenu();
153 virtual void EndOccultCommands();
161 virtual std::unique_ptr<CommandListEntry>
184 bool bIsEffect =
false);
210 bool mbSeparatorAllowed{
false };
218 int mCurrentID{ 17000 };
219 bool bMakingOccultCommands{
false };
225 void EnableUsingFlags(
227 void Enable(
const wxString &
name,
bool enabled);
239 bool HandleMenuID(
int id,
CommandFlag flags,
bool alwaysEnabled);
263 void GetAllCommandLabels(
265 bool includeMultis)
const;
266 void GetAllCommandData(
268 std::vector<NormalizedKeyString> &keys,
269 std::vector<NormalizedKeyString> &default_keys,
276 CommandID GetNameFromNumericID(
int id)
const;
285 int GetNumberOfKeysRead()
const;
297 void WriteXML(
XMLWriter &xmlFile)
const ;
308 static const std::vector<NormalizedKeyString> &ExcludedList();
312 static int NextIdentifier(
int ID);
315 bool HandleCommandEntry(
317 bool alwaysEnabled,
const wxEvent * evt =
nullptr,
335 void UpdateCheckmarks();
342 wxString FormatLabelForMenu(
345 void ModifyUndoMenuItems();
349 void UpdateMenus(
bool checkActive =
true);
353 virtual bool ReallyDoQuickCheck();
376 static wxString FormatLabelForMenu(
387 virtual bool GetEnabled()
const;
389 virtual void Check(
bool checked);
391 virtual void Enable(
bool enabled);
393 virtual void EnableMultiItem(
bool enabled);
396 return FormatLabelForMenu(
label,
key);
427 bool useStrictFlags{
false };
432 std::unordered_map<NormalizedKeyString, CommandListEntry*>;
441 using CommandList = std::vector<std::unique_ptr<CommandListEntry>>;
Functions and classes that generate callable objects.
Utility ClientData::Site to register hooks into a host class that attach client data.
constexpr CommandFlag AlwaysEnabledFlag
std::bitset< NCommandFlags > CommandFlag
std::function< CommandHandlerObject &(AudacityProject &) > CommandHandlerFinder
std::vector< CommandID > CommandIDs
static ProjectFileIORegistry::AttributeWriterEntry entry
std::vector< TranslatableString > TranslatableStrings
std::vector< Attribute > AttributesList
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
This specialization of Setting for bool adds a Toggle method to negate the saved value.
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
CommandListEntry is a structure used by CommandManager.
CommandManager implements a system for organizing all user-callable commands.
CommandManager & operator=(const CommandManager &)=delete
CommandNameHash mCommandNameHash
AudacityProject & mProject
std::unordered_map< int, CommandListEntry * > CommandNumericIDHash
static const TranslatableString COMMAND
std::unordered_map< CommandID, CommandListEntry * > CommandNameHash
CommandKeyHash mCommandKeyHash
std::unordered_map< NormalizedKeyString, CommandListEntry * > CommandKeyHash
std::vector< std::unique_ptr< CommandListEntry > > CommandList
AudacityProject & GetProject()
CommandManager(const CommandManager &)=delete
const Observer::Subscription mUndoSubscription
TranslatableString mNiceName
CommandNumericIDHash mCommandNumericIDHash
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Global function-valued variable, adding a convenient Call()
An object that sends messages to an open-ended list of subscribed callbacks.
A move-only handle representing a connection to a Publisher.
A listener notified of changes in preferences.
virtual void UpdatePrefs()=0
Holds a msgid for the translation catalog; may also bind format arguments.
This class is an interface which should be implemented by classes which wish to be able to load and s...
virtual XMLTagHandler * HandleXMLChild(const std::string_view &tag)=0
virtual void HandleXMLEndTag(const std::string_view &WXUNUSED(tag))
virtual bool HandleXMLTag(const std::string_view &tag, const AttributesList &attrs)=0
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
AUDACITY_DLL_API bool HandleTextualCommand(const CommandID &Str, const CommandContext &context, CommandFlag flags, bool alwaysEnabled)
std::vector< Identifier > Path
A convenient default parameter for class template Site.
TranslatableString labelTop
std::function< bool(AudacityProject &) > CheckFn
CommandFunctorPointer callback
NormalizedKeyString defaultKey
virtual ~CommandListEntry()
TranslatableString longLabel
TranslatableString labelPrefix
CommandHandlerFinder finder
wxString FormatLabelForMenu() const
CommandParameter parameter
std::vector< bool > mFlags
const TranslatableStrings & MenuNames() const
Stack of names of menus that were begun and not yet ended.
std::vector< NormalizedKeyString > mMaxListOnly
std::function< void(const Registry::SingleItem &, const Registry::Path &)> LeafVisitor
AudacityProject & mProject
TranslatableStrings mMenuNames
Has variadic and range constructors that check types.
Common abstract base class for items that are not groups.
Type of message published by UndoManager.