mirror of
https://github.com/cookiengineer/audacity
synced 2026-03-10 16:35:32 +01:00
Several nonmodal top level window tools register their menu items...
... removing link dependencies on them from src/menus, so they are now suitable for moving out into modules. They are: Mixer Board Karaoke (also called Lyrics) History Contrast Plot Spectrum Their header files are now no longer included anywhere but in their own implementation files!
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include "widgets/AudacityMessageBox.h"
|
||||
#include "widgets/ErrorDialog.h"
|
||||
|
||||
#include <mutex>
|
||||
#include <unordered_set>
|
||||
|
||||
#include <wx/menu.h>
|
||||
@@ -1000,7 +1001,38 @@ static const auto menuTree = MenuTable::Items( MenuPathStart
|
||||
);
|
||||
|
||||
namespace {
|
||||
|
||||
// Once only, cause initial population of preferences for the ordering
|
||||
// of some menu items that used to be given in tables but are now separately
|
||||
// registered in several .cpp files; the sequence of registration depends
|
||||
// on unspecified accidents of static initialization order across
|
||||
// compilation units, so we need something specific here to preserve old
|
||||
// default appearance of menus.
|
||||
// But this needs only to mention some strings -- there is no compilation or
|
||||
// link dependency of this source file on those other implementation files.
|
||||
void InitializeMenuOrdering()
|
||||
{
|
||||
using Pair = std::pair<const wxChar *, const wxChar *>;
|
||||
static const Pair pairs [] = {
|
||||
{wxT("/View/Windows"), wxT("UndoHistory,Karaoke,MixerBoard")},
|
||||
{wxT("/Analyze/Analyzers/Windows"), wxT("ContrastAnalyser,PlotSpectrum")},
|
||||
};
|
||||
|
||||
bool doFlush = false;
|
||||
for (auto pair : pairs) {
|
||||
const auto key = wxString{'/'} + MenuPathStart + pair.first;
|
||||
if ( gPrefs->Read(key).empty() ) {
|
||||
gPrefs->Write( key, pair.second );
|
||||
doFlush = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (doFlush)
|
||||
gPrefs->Flush();
|
||||
}
|
||||
|
||||
using namespace MenuTable;
|
||||
|
||||
struct MenuItemVisitor : MenuVisitor
|
||||
{
|
||||
MenuItemVisitor( AudacityProject &proj, CommandManager &man )
|
||||
@@ -1102,6 +1134,9 @@ struct MenuItemVisitor : MenuVisitor
|
||||
|
||||
void MenuCreator::CreateMenusAndCommands(AudacityProject &project)
|
||||
{
|
||||
static std::once_flag flag;
|
||||
std::call_once( flag, InitializeMenuOrdering );
|
||||
|
||||
auto &commandManager = CommandManager::Get( project );
|
||||
|
||||
// The list of defaults to exclude depends on
|
||||
|
||||
Reference in New Issue
Block a user