Audacity 3.2.0
|
MenuManager handles updates to menu state. More...
#include <Menus.h>
Public Member Functions | |
MenuManager (AudacityProject &project) | |
MenuManager (const MenuManager &)=delete | |
MenuManager & | operator= (const MenuManager &)=delete |
~MenuManager () | |
void | UpdateMenus (bool checkActive=true) |
CommandFlag | GetUpdateFlags (bool checkActive=false) const |
void | UpdatePrefs () override |
bool | ReportIfActionNotAllowed (const TranslatableString &Name, CommandFlag &flags, CommandFlag flagsRqd) |
bool | TryToMakeActionAllowed (CommandFlag &flags, CommandFlag flagsRqd) |
Public Member Functions inherited from MenuCreator | |
MenuCreator () | |
~MenuCreator () | |
void | CreateMenusAndCommands (AudacityProject &project) |
void | RebuildMenuBar (AudacityProject &project) |
Public Member Functions inherited from ClientData::Base | |
virtual | ~Base () |
Public Member Functions inherited from Observer::Publisher< MenuUpdateMessage > | |
Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={}) | |
Constructor supporting type-erased custom allocation/deletion. More... | |
Publisher (Publisher &&)=default | |
Publisher & | operator= (Publisher &&)=default |
Subscription | Subscribe (Callback callback) |
Connect a callback to the Publisher; later-connected are called earlier. More... | |
Subscription | Subscribe (Object &obj, Return(Object::*callback)(Args...)) |
Overload of Subscribe takes an object and pointer-to-member-function. More... | |
Static Public Member Functions | |
static MenuManager & | Get (AudacityProject &project) |
static const MenuManager & | Get (const AudacityProject &project) |
static void | Visit (MenuTable::Visitor< MenuTable::Traits > &visitor, AudacityProject &project) |
static void | ModifyUndoMenuItems (AudacityProject &project) |
Static Public Member Functions inherited from MenuCreator | |
static void | RebuildAllMenuBars () |
Public Attributes | |
int | mWhatIfNoSelection |
bool | mStopIfWasPaused |
Public Attributes inherited from MenuCreator | |
CommandFlag | mLastFlags |
PluginID | mLastGenerator {} |
PluginID | mLastEffect {} |
PluginID | mLastAnalyzer {} |
int | mLastAnalyzerRegistration |
int | mLastAnalyzerRegisteredId |
PluginID | mLastTool {} |
int | mLastToolRegistration |
int | mLastToolRegisteredId |
unsigned | mRepeatGeneratorFlags |
unsigned | mRepeatEffectFlags |
unsigned | mRepeatAnalyzerFlags |
unsigned | mRepeatToolFlags |
Private Member Functions | |
void | TellUserWhyDisallowed (const TranslatableString &Name, CommandFlag flagsGot, CommandFlag flagsRequired) |
void | OnUndoRedo (struct UndoRedoMessage) |
Private Member Functions inherited from PrefsListener | |
PrefsListener () | |
virtual | ~PrefsListener () |
virtual void | UpdatePrefs ()=0 |
virtual void | UpdateSelectedPrefs (int id) |
Private Attributes | |
Observer::Subscription | mUndoSubscription |
AudacityProject & | mProject |
Additional Inherited Members | |
Public Types inherited from MenuCreator | |
enum | { repeattypenone = 0 , repeattypeplugin = 1 , repeattypeunique = 2 , repeattypeapplymacro = 3 } |
Public Types inherited from Observer::Publisher< MenuUpdateMessage > | |
using | message_type = MenuUpdateMessage |
using | CallbackReturn = std::conditional_t< true, void, bool > |
using | Callback = std::function< CallbackReturn(const MenuUpdateMessage &) > |
Type of functions that can be connected to the Publisher. More... | |
Static Public Attributes inherited from Observer::Publisher< MenuUpdateMessage > | |
static constexpr bool | notifies_all |
Protected Member Functions inherited from Observer::Publisher< MenuUpdateMessage > | |
CallbackReturn | Publish (const MenuUpdateMessage &message) |
Send a message to connected callbacks. More... | |
Static Private Member Functions inherited from PrefsListener | |
static void | Broadcast (int id=0) |
Call this static function to notify all PrefsListener objects. More... | |
MenuManager handles updates to menu state.
|
explicit |
Definition at line 79 of file Menus.cpp.
References UndoManager::Get(), mUndoSubscription, OnUndoRedo(), project, Observer::Publisher< Message, NotifyAll >::Subscribe(), and UpdatePrefs().
|
delete |
|
static |
Definition at line 69 of file Menus.cpp.
Referenced by anonymous_namespace{PluginMenus.cpp}::AnalyzeMenu(), MacroCommands::ApplyCommandInBatchMode(), ToolManager::CreateWindows(), CommonTrackPanelCell::DoContextMenu(), EffectUI::DoEffect(), ProjectAudioManager::DoRecord(), DoReloadPreferences(), anonymous_namespace{PluginMenus.cpp}::EffectMenu(), CommandManager::FilterKeyEvent(), ProjectWindow::FixScrollbars(), anonymous_namespace{PluginMenus.cpp}::GenerateMenu(), Get(), CommandManager::HandleCommandEntry(), anonymous_namespace{PluginMenus.cpp}::HasLastAnalyzerFlag(), anonymous_namespace{PluginMenus.cpp}::HasLastEffectFlag(), anonymous_namespace{PluginMenus.cpp}::HasLastGeneratorFlag(), anonymous_namespace{BatchProcessDialog.cpp}::HasLastToolFlag(), ProjectManager::New(), EffectUIHost::OnApply(), anonymous_namespace{BatchProcessDialog.cpp}::OnApplyMacroDirectlyByName(), ToolBarButtons::OnButton(), ProjectWindow::OnMenu(), anonymous_namespace{EditMenus.cpp}::OnPreferences(), anonymous_namespace{PluginMenus.cpp}::OnRepeatLastAnalyzer(), anonymous_namespace{PluginMenus.cpp}::OnRepeatLastEffect(), anonymous_namespace{PluginMenus.cpp}::OnRepeatLastGenerator(), anonymous_namespace{BatchProcessDialog.cpp}::OnRepeatLastTool(), anonymous_namespace{PluginMenus.cpp}::OnResetConfig(), ProjectWindow::OnUpdateUI(), PluginMenuItems(), MenuCreator::RebuildAllMenuBars(), CommandManager::RegisterLastAnalyzer(), CommandManager::RegisterLastTool(), SelectUtilities::SelectAllIfNone(), SelectUtilities::SelectAllIfNoneAndAllowed(), and MacrosWindow::UpdateMenus().
|
static |
Definition at line 74 of file Menus.cpp.
References Get(), and project.
CommandFlag MenuManager::GetUpdateFlags | ( | bool | checkActive = false | ) | const |
Definition at line 517 of file Menus.cpp.
References GetProjectFrame(), mProject, ReservedCommandFlag::Options(), and ReservedCommandFlag::RegisteredPredicates().
Referenced by CommandManager::FilterKeyEvent(), ToolBarButtons::OnButton(), ProjectWindow::OnMenu(), SelectUtilities::SelectAllIfNone(), SelectUtilities::SelectAllIfNoneAndAllowed(), TryToMakeActionAllowed(), and UpdateMenus().
|
static |
Definition at line 433 of file Menus.cpp.
References anonymous_namespace{ExportPCM.cpp}::desc, ProjectHistory::Get(), UndoManager::Get(), CommandManager::Get(), project, wxT(), and XXO().
Referenced by anonymous_namespace{EditMenus.cpp}::EditMenu(), anonymous_namespace{BatchProcessDialog.cpp}::OnApplyMacroDirectlyByName(), and OnUndoRedo().
|
private |
Definition at line 502 of file Menus.cpp.
References ModifyUndoMenuItems(), mProject, UndoRedoMessage::Pushed, UndoRedoMessage::Renamed, UndoRedoMessage::Reset, UndoRedoMessage::type, UndoRedoMessage::UndoOrRedo, and UpdateMenus().
Referenced by MenuManager().
|
delete |
bool MenuManager::ReportIfActionNotAllowed | ( | const TranslatableString & | Name, |
CommandFlag & | flags, | ||
CommandFlag | flagsRqd | ||
) |
Definition at line 621 of file Menus.cpp.
References CommandManager::Get(), mProject, project, TellUserWhyDisallowed(), and TryToMakeActionAllowed().
Referenced by CommandManager::HandleCommandEntry(), and EffectUIHost::OnApply().
|
private |
Definition at line 667 of file Menus.cpp.
References ReservedCommandFlag::Options(), BasicUI::ShowErrorDialog(), and XO().
Referenced by ReportIfActionNotAllowed().
bool MenuManager::TryToMakeActionAllowed | ( | CommandFlag & | flags, |
CommandFlag | flagsRqd | ||
) |
Determines if flags for command are compatible with current state. If not, then try some recovery action to make it so.
Definition at line 636 of file Menus.cpp.
References RegisteredMenuItemEnabler::Enablers(), PackedArray::end(), GetUpdateFlags(), mProject, and project.
Referenced by ProjectAudioManager::DoRecord(), and ReportIfActionNotAllowed().
void MenuManager::UpdateMenus | ( | bool | checkActive = true | ) |
Definition at line 559 of file Menus.cpp.
References RegisteredMenuItemEnabler::Enablers(), CommandManager::Get(), GetUpdateFlags(), MenuCreator::mLastFlags, mProject, mWhatIfNoSelection, project, and Observer::Publisher< MenuUpdateMessage >::Publish().
Referenced by MacroCommands::ApplyCommandInBatchMode(), EffectUI::DoEffect(), ProjectWindow::FixScrollbars(), OnUndoRedo(), and ProjectWindow::OnUpdateUI().
|
overridevirtual |
Implements PrefsListener.
Definition at line 91 of file Menus.cpp.
References gPrefs, mStopIfWasPaused, mWhatIfNoSelection, audacity::BasicSettings::Read(), and wxT().
Referenced by MenuManager().
|
static |
Definition at line 422 of file Menus.cpp.
References MenuTable::Items, MenuPathStart, project, MenuTable::ItemRegistry::Registry(), and Registry::VisitWithFunctions().
Referenced by MenuCreator::CreateMenusAndCommands(), and anonymous_namespace{HelpMenus.cpp}::OnMenuTree().
|
private |
Definition at line 122 of file Menus.h.
Referenced by GetUpdateFlags(), OnUndoRedo(), ReportIfActionNotAllowed(), TryToMakeActionAllowed(), and UpdateMenus().
bool MenuManager::mStopIfWasPaused |
Definition at line 127 of file Menus.h.
Referenced by UpdatePrefs().
|
private |
Definition at line 121 of file Menus.h.
Referenced by MenuManager().
int MenuManager::mWhatIfNoSelection |
Definition at line 126 of file Menus.h.
Referenced by UpdateMenus(), and UpdatePrefs().