mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-18 16:41:14 +02:00
Rewrite insertion of menu items by null and Nyquist modules...
... using the new registration system, and without the fragile hacks making assumptions about the positions of menus within the menu bar.
This commit is contained in:
@@ -146,33 +146,6 @@ int ModuleDispatch(ModuleDispatchTypes type)
|
||||
break;
|
||||
case AppQuiting:
|
||||
break;
|
||||
case ProjectInitialized:
|
||||
case MenusRebuilt:
|
||||
{
|
||||
AudacityProject *p = GetActiveProject();
|
||||
if( p== NULL )
|
||||
return 0;
|
||||
|
||||
wxMenuBar * pBar = GetProjectFrame( *p ).GetMenuBar();
|
||||
wxMenu * pMenu = pBar->GetMenu( 8 ); // Menu 8 is the Analyze Menu.
|
||||
CommandManager * c = &CommandManager::Get( *p );
|
||||
|
||||
c->SetCurrentMenu( pMenu );
|
||||
c->AddSeparator();
|
||||
// We add two new commands into the Analyze menu.
|
||||
c->AddItem( *p,
|
||||
_T("A New Command"), // internal name
|
||||
XO("1st Experimental Command..."), //displayed name
|
||||
ident, ModNullFN( OnFuncFirst ),
|
||||
AudioIONotBusyFlag() );
|
||||
c->AddItem( *p,
|
||||
_T("Another New Command"),
|
||||
XO("2nd Experimental Command"),
|
||||
ident, ModNullFN( OnFuncSecond ),
|
||||
AudioIONotBusyFlag() );
|
||||
c->ClearCurrentMenu();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -180,6 +153,26 @@ 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
|
||||
|
Reference in New Issue
Block a user