1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 14:02:57 +02:00

Hide details of managing occult command items

This commit is contained in:
Paul Licameli
2018-10-20 14:01:20 -04:00
parent 01875db4bd
commit 5277584bb0
3 changed files with 22 additions and 12 deletions

View File

@@ -1831,9 +1831,24 @@ void CommandManager::WriteXML(XMLWriter &xmlFile) const
xmlFile.EndTag(wxT("audacitykeyboard"));
}
void CommandManager::SetOccultCommands( bool bOccult)
void CommandManager::BeginOccultCommands()
{
bMakingOccultCommands = bOccult;
// To do: perhaps allow occult item switching at lower levels of the
// menu tree.
wxASSERT( !CurrentMenu() );
// Make a temporary menu bar collecting items added after.
// This bar will be discarded but other side effects on the command
// manager persist.
mTempMenuBar = AddMenuBar(wxT("ext-menu"));
bMakingOccultCommands = true;
}
void CommandManager::EndOccultCommands()
{
PopMenuBar();
bMakingOccultCommands = false;
mTempMenuBar.reset();
}
void CommandManager::SetCommandFlags(const wxString &name,

View File

@@ -212,7 +212,8 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
CommandFlag flags);
void PopMenuBar();
void SetOccultCommands( bool bOccult);
void BeginOccultCommands();
void EndOccultCommands();
void SetCommandFlags(const wxString &name, CommandFlag flags, CommandMask mask);
@@ -394,6 +395,7 @@ private:
wxMenu *mCurrentMenu {};
bool bMakingOccultCommands;
std::unique_ptr< wxMenuBar > mTempMenuBar;
};
#endif