mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-20 14:20:06 +02:00
Hide details of managing occult command items
This commit is contained in:
parent
01875db4bd
commit
5277584bb0
@ -390,7 +390,6 @@ void MenuCreator::CreateMenusAndCommands(AudacityProject &project)
|
|||||||
{
|
{
|
||||||
auto menubar = c->AddMenuBar(wxT("appmenu"));
|
auto menubar = c->AddMenuBar(wxT("appmenu"));
|
||||||
wxASSERT(menubar);
|
wxASSERT(menubar);
|
||||||
c->SetOccultCommands( false );
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// File menu
|
// File menu
|
||||||
@ -1394,14 +1393,9 @@ void MenuCreator::CreateMenusAndCommands(AudacityProject &project)
|
|||||||
|
|
||||||
bool bShowExtraMenus;
|
bool bShowExtraMenus;
|
||||||
gPrefs->Read(wxT("/GUI/ShowExtraMenus"), &bShowExtraMenus, false);
|
gPrefs->Read(wxT("/GUI/ShowExtraMenus"), &bShowExtraMenus, false);
|
||||||
std::unique_ptr<wxMenuBar> menubar2;
|
|
||||||
if( !bShowExtraMenus )
|
if( !bShowExtraMenus )
|
||||||
{
|
{
|
||||||
// Make a temporary menu bar collecting items added below.
|
c->BeginOccultCommands();
|
||||||
// This bar will be discarded but other side effects on the command
|
|
||||||
// manager persist.
|
|
||||||
menubar2 = c->AddMenuBar(wxT("ext-menu"));
|
|
||||||
c->SetOccultCommands(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@ -1794,8 +1788,7 @@ void MenuCreator::CreateMenusAndCommands(AudacityProject &project)
|
|||||||
|
|
||||||
if (!bShowExtraMenus)
|
if (!bShowExtraMenus)
|
||||||
{
|
{
|
||||||
c->PopMenuBar();
|
c->EndOccultCommands();
|
||||||
c->SetOccultCommands(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1831,9 +1831,24 @@ void CommandManager::WriteXML(XMLWriter &xmlFile) const
|
|||||||
xmlFile.EndTag(wxT("audacitykeyboard"));
|
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,
|
void CommandManager::SetCommandFlags(const wxString &name,
|
||||||
|
@ -212,7 +212,8 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
|
|||||||
CommandFlag flags);
|
CommandFlag flags);
|
||||||
|
|
||||||
void PopMenuBar();
|
void PopMenuBar();
|
||||||
void SetOccultCommands( bool bOccult);
|
void BeginOccultCommands();
|
||||||
|
void EndOccultCommands();
|
||||||
|
|
||||||
|
|
||||||
void SetCommandFlags(const wxString &name, CommandFlag flags, CommandMask mask);
|
void SetCommandFlags(const wxString &name, CommandFlag flags, CommandMask mask);
|
||||||
@ -394,6 +395,7 @@ private:
|
|||||||
wxMenu *mCurrentMenu {};
|
wxMenu *mCurrentMenu {};
|
||||||
|
|
||||||
bool bMakingOccultCommands;
|
bool bMakingOccultCommands;
|
||||||
|
std::unique_ptr< wxMenuBar > mTempMenuBar;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user