1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-15 07:01:18 +02:00

Modules should register their menu items only after version check

This commit is contained in:
Paul Licameli
2020-02-16 13:28:40 -05:00
parent 11bbce10b1
commit 5c85deb944
2 changed files with 49 additions and 37 deletions

View File

@@ -136,12 +136,38 @@ const wxChar * GetVersionString()
return AUDACITY_VERSION_STRING;
}
namespace {
void RegisterMenuItems()
{
// Get here only after the module version check passes
using namespace MenuTable;
// We add two new commands into the Analyze menu.
static AttachedItem sAttachment{ wxT("Analyze"),
( FinderScope( ident ), Section( wxT("NullModule"),
Command(
_T("A New Command"), // internal name
XO("1st Experimental Command..."), //displayed name
ModNullFN( OnFuncFirst ),
AudioIONotBusyFlag() ),
Command(
_T("Another New Command"),
XO("2nd Experimental Command"),
ModNullFN( OnFuncSecond ),
AudioIONotBusyFlag() )
) )
};
}
}
// This is the function that connects us to Audacity.
extern int DLL_API ModuleDispatch(ModuleDispatchTypes type);
int ModuleDispatch(ModuleDispatchTypes type)
{
switch (type)
{
case ModuleInitialize:
RegisterMenuItems();
break;
case AppInitialized:
break;
case AppQuiting:
@@ -153,26 +179,6 @@ int ModuleDispatch(ModuleDispatchTypes type)
return 1;
}
// Register our extra menu items
namespace {
using namespace MenuTable;
// We add two new commands into the Analyze menu.
AttachedItem sAttachment{ wxT("Analyze"),
( FinderScope( ident ), Section( wxT("NullModule"),
Command(
_T("A New Command"), // internal name
XO("1st Experimental Command..."), //displayed name
ModNullFN( OnFuncFirst ),
AudioIONotBusyFlag() ),
Command(
_T("Another New Command"),
XO("2nd Experimental Command"),
ModNullFN( OnFuncSecond ),
AudioIONotBusyFlag() )
) )
};
}
//Example code commented out.
#if 0
// This is an example function to hijack the main panel