mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-21 14:02:57 +02:00
Don't call CommandManger::AddGlobalCommand, use an option instead
This commit is contained in:
@@ -754,6 +754,13 @@ void CommandManager::AddItem(const wxChar *name,
|
||||
CommandFlag flags,
|
||||
const Options &options)
|
||||
{
|
||||
if (options.global) {
|
||||
wxASSERT( flags == AlwaysEnabledFlag );
|
||||
AddGlobalCommand(
|
||||
name, label_in, hasDialog, finder, callback, options.accel );
|
||||
return;
|
||||
}
|
||||
|
||||
wxASSERT( flags != NoFlagsSpecified );
|
||||
|
||||
auto mask = options.mask;
|
||||
|
@@ -166,6 +166,8 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
|
||||
{ mask = value; return std::move(*this); }
|
||||
Options &&LongName (const wxString &value) &&
|
||||
{ longName = value; return std::move(*this); }
|
||||
Options &&IsGlobal () &&
|
||||
{ global = true; return std::move(*this); }
|
||||
|
||||
const wxChar *accel{ wxT("") };
|
||||
int check{ -1 }; // default value means it's not a check item
|
||||
@@ -173,6 +175,7 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
|
||||
CommandParameter parameter{};
|
||||
CommandMask mask{ NoFlagsSpecified };
|
||||
wxString longName{}; // translated
|
||||
bool global{ false };
|
||||
};
|
||||
|
||||
void AddItemList(const wxString & name,
|
||||
@@ -208,13 +211,6 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
|
||||
const wxChar *accel,
|
||||
CommandFlag flags);
|
||||
|
||||
void AddGlobalCommand(const wxChar *name,
|
||||
const wxChar *label,
|
||||
bool hasDialog,
|
||||
CommandHandlerFinder finder,
|
||||
CommandFunctorPointer callback,
|
||||
const wxChar *accel);
|
||||
|
||||
void SwapMenuBars();
|
||||
void SetOccultCommands( bool bOccult);
|
||||
|
||||
@@ -303,7 +299,7 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
|
||||
// Sorted list of the shortcut keys to be exluded from the standard defaults
|
||||
static const std::vector<NormalizedKeyString> &ExcludedList();
|
||||
|
||||
protected:
|
||||
private:
|
||||
|
||||
//
|
||||
// Creating menus and adding commands
|
||||
@@ -334,6 +330,13 @@ protected:
|
||||
int count,
|
||||
bool bIsEffect,
|
||||
const CommandParameter ¶meter);
|
||||
|
||||
void AddGlobalCommand(const wxChar *name,
|
||||
const wxChar *label,
|
||||
bool hasDialog,
|
||||
CommandHandlerFinder finder,
|
||||
CommandFunctorPointer callback,
|
||||
const wxChar *accel);
|
||||
|
||||
//
|
||||
// Executing commands
|
||||
|
Reference in New Issue
Block a user