1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-16 08:34:10 +02:00

Fix build of Nyquist Workbench

This commit is contained in:
Leland Lucius 2016-10-01 14:05:53 -05:00
parent 921b769b52
commit 2ab0c13101
4 changed files with 39 additions and 26 deletions

View File

@ -162,11 +162,6 @@ extern "C"
// and ask if it has anything for the menus.
int ModuleDispatch(ModuleDispatchTypes type){
switch (type){
case AppInitialized:{
wxASSERT(gBench == NULL);
gBench = new NyqBench(NULL);
}
break;
case AppQuiting: {
wxASSERT(gBench != NULL);
if (gBench) {
@ -187,13 +182,14 @@ extern "C"
wxMenu * pMenu = pBar->GetMenu( 2 ); // Menu 2 is the View Menu.
wxASSERT( pMenu != NULL );
c->SetToMenu( pMenu );
c->SetCurrentMenu(pMenu);
c->AddSeparator();
// c->BeginMenu(_("T&ools"));
c->SetDefaultFlags(AudioIONotBusyFlag, AudioIONotBusyFlag);
c->AddItem(wxT("NyqBench"),
_("&Nyquist Workbench..."),
new ModNyqBenchCommandFunctor());
FNT(NyqBench, NyqBench::GetBench(), &NyqBench::ShowNyqBench));
c->ClearCurrentMenu();
}
break;
default:
@ -590,18 +586,6 @@ void NyqRedirector::AppendText()
s.clear();
}
//----------------------------------------------------------------------------
// ModNyqBenchCommandFunctor
// Connects Audacity menu item to an action in this dll.
// Only one action implemented so far.
//----------------------------------------------------------------------------
void ModNyqBenchCommandFunctor::operator()(int index, const wxEvent *e)
{
if (gBench) {
gBench->Show();
}
}
//----------------------------------------------------------------------------
// NyqBench
//----------------------------------------------------------------------------
@ -703,6 +687,16 @@ BEGIN_EVENT_TABLE(NyqBench, wxFrame)
EVT_UPDATE_UI(ID_OUTPUT, NyqBench::OnOutputUpdate)
END_EVENT_TABLE()
/*static*/ NyqBench *NyqBench::GetBench()
{
if (gBench == nullptr)
{
gBench = new NyqBench(NULL);
}
return gBench;
}
NyqBench::NyqBench(wxWindow * parent)
: wxFrame(NULL,
wxID_ANY,
@ -1769,3 +1763,12 @@ void NyqBench::LoadFile()
// mScript->LoadFile(mPath.GetFullPath());
}
//----------------------------------------------------------------------------
// Connects Audacity menu item to an action in this dll.
// Only one action implemented so far.
//----------------------------------------------------------------------------
void NyqBench::ShowNyqBench()
{
Show();
}

View File

@ -111,6 +111,10 @@ class NyqBench:public wxFrame
virtual bool Validate();
void ShowNyqBench();
static NyqBench *GetBench();
private:
void PopulateOrExchange(ShuttleGui & S);
@ -215,12 +219,6 @@ class NyqBench:public wxFrame
DECLARE_EVENT_TABLE();
};
class ModNyqBenchCommandFunctor:public CommandFunctor
{
public:
virtual void operator()(int index = 0, const wxEvent *e = NULL);
};
#endif
// Indentation settings for Vim and Emacs and unique identifier for Arch, a

View File

@ -581,6 +581,16 @@ wxMenu * CommandManager::CurrentMenu() const
return tmpCurrentSubMenu;
}
void CommandManager::SetCurrentMenu(wxMenu * menu)
{
mCurrentMenu.reset(menu);
}
void CommandManager::ClearCurrentMenu()
{
mCurrentMenu.release();
}
///
/// Add a menu item to the current menu. When the user selects it, the
/// given functor will be called

View File

@ -198,6 +198,8 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
void Enable(const wxString &name, bool enabled);
void Check(const wxString &name, bool checked);
void Modify(const wxString &name, const wxString &newLabel);
void SetCurrentMenu(wxMenu * menu);
void ClearCurrentMenu();
//
// Modifying accelerators