mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-05 06:39:26 +02:00
Don't call CommandManger::AddGlobalCommand, use an option instead
This commit is contained in:
parent
c9d9871f6c
commit
fefc3bf35d
@ -1594,8 +1594,13 @@ void MenuCreator::CreateMenusAndCommands(AudacityProject &project)
|
||||
|
||||
c->AddSeparator();
|
||||
|
||||
c->AddGlobalCommand(wxT("PrevWindow"), XXO("Move Backward Through Active Windows"), FN(OnPrevWindow), wxT("Alt+Shift+F6"));
|
||||
c->AddGlobalCommand(wxT("NextWindow"), XXO("Move Forward Through Active Windows"), FN(OnNextWindow), wxT("Alt+F6"));
|
||||
// Global commands
|
||||
c->AddItem( wxT("PrevWindow"), XXO("Move Backward Through Active Windows"),
|
||||
FN(OnPrevWindow), AlwaysEnabledFlag,
|
||||
Options{ wxT("Alt+Shift+F6") }.IsGlobal() );
|
||||
c->AddItem( wxT("NextWindow"), XXO("Move Forward Through Active Windows"),
|
||||
FN(OnNextWindow), AlwaysEnabledFlag,
|
||||
Options{ wxT("Alt+F6") }.IsGlobal() );
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user