1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-25 08:38:39 +02:00

Bug 1648 - Crash clicking Help icon in Spectrograms Settings

This commit is contained in:
James Crook 2017-05-20 09:25:18 +01:00
parent 01f853f174
commit 4e187d0ce0
2 changed files with 18 additions and 6 deletions

View File

@ -280,6 +280,10 @@ PrefsDialog::PrefsDialog
S.EndHorizontalLay(); S.EndHorizontalLay();
} }
else { else {
// TODO: Look into getting rid of mUniquePage and instead
// adding into mCategories, so there is just one page in mCategories.
// And then hiding the trrebook.
// Unique page, don't show the factory // Unique page, don't show the factory
const PrefsNode &node = factories[0]; const PrefsNode &node = factories[0];
PrefsPanelFactory &factory = *node.pFactory; PrefsPanelFactory &factory = *node.pFactory;
@ -386,18 +390,25 @@ void PrefsDialog::OnCancel(wxCommandEvent & WXUNUSED(event))
EndModal(false); EndModal(false);
} }
PrefsPanel * PrefsDialog::GetCurrentPanel()
{
if( mCategories)
return static_cast<PrefsPanel*>(mCategories->GetCurrentPage());
else
{
wxASSERT( mUniquePage );
return mUniquePage;
}
}
void PrefsDialog::OnApply(wxCommandEvent & WXUNUSED(event)) void PrefsDialog::OnApply(wxCommandEvent & WXUNUSED(event))
{ {
if (mCategories) GetCurrentPanel()->Apply();
static_cast<PrefsPanel*>(mCategories->GetCurrentPage())->Apply();
else
mUniquePage->Apply();
} }
void PrefsDialog::OnHelp(wxCommandEvent & WXUNUSED(event)) void PrefsDialog::OnHelp(wxCommandEvent & WXUNUSED(event))
{ {
PrefsPanel* panel = static_cast<PrefsPanel*>(mCategories->GetCurrentPage()); HelpSystem::ShowHelpDialog(this, GetCurrentPanel()->HelpPageName(), true);
HelpSystem::ShowHelpDialog(this, panel->HelpPageName(), true);
} }
void PrefsDialog::OnTreeKeyDown(wxTreeEvent & event) void PrefsDialog::OnTreeKeyDown(wxTreeEvent & event)

View File

@ -78,6 +78,7 @@ class PrefsDialog /* not final */ : public wxDialogWrapper
private: private:
void RecordExpansionState(); void RecordExpansionState();
PrefsPanel * GetCurrentPanel();
wxTreebook *mCategories{}; wxTreebook *mCategories{};
PrefsPanel *mUniquePage{}; PrefsPanel *mUniquePage{};
Factories &mFactories; Factories &mFactories;