1
0
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:
Paul Licameli
2018-10-20 11:17:03 -04:00
parent c9d9871f6c
commit fefc3bf35d
3 changed files with 25 additions and 10 deletions

View File

@@ -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;

View File

@@ -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 &parameter);
void AddGlobalCommand(const wxChar *name,
const wxChar *label,
bool hasDialog,
CommandHandlerFinder finder,
CommandFunctorPointer callback,
const wxChar *accel);
//
// Executing commands