diff --git a/src/Menus.cpp b/src/Menus.cpp index b60812a32..b64072463 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -5738,7 +5738,7 @@ void AudacityProject::OnHelpWelcome() void AudacityProject::OnQuickHelp() { - ShowHelpDialog( + HelpSystem::ShowHelpDialog( this, FileNames::HtmlHelpIndexFile(true), wxT("http://manual.audacityteam.org/o/quick_help.html" )); @@ -5746,7 +5746,7 @@ void AudacityProject::OnQuickHelp() void AudacityProject::OnManual() { - ShowHelpDialog( + HelpSystem::ShowHelpDialog( this, FileNames::HtmlHelpIndexFile(false), wxT("http://manual.audacityteam.org/o/" )); @@ -5773,7 +5773,7 @@ void AudacityProject::OnScreenshot() void AudacityProject::OnAudioDeviceInfo() { wxString info = gAudioIO->GetDeviceInfo(); - ShowInfoDialog( this, + HelpSystem::ShowInfoDialog( this, _("Audio Device Info"), wxT(""), info, diff --git a/src/export/ExportMultiple.cpp b/src/export/ExportMultiple.cpp index bda4b4d88..45057f42c 100644 --- a/src/export/ExportMultiple.cpp +++ b/src/export/ExportMultiple.cpp @@ -550,7 +550,7 @@ void ExportMultiple::OnExport(wxCommandEvent& WXUNUSED(event)) FileList += '\n'; } // This results dialog is a child of this dialog. - ShowInfoDialog( this, + HelpSystem::ShowInfoDialog( this, _("Export Multiple"), msg, FileList, diff --git a/src/widgets/ErrorDialog.cpp b/src/widgets/ErrorDialog.cpp index 8dcf1f8d9..f4dda4b0c 100644 --- a/src/widgets/ErrorDialog.cpp +++ b/src/widgets/ErrorDialog.cpp @@ -147,7 +147,7 @@ void ErrorDialog::OnHelp(wxCommandEvent & WXUNUSED(event)) { if( dhelpURL.StartsWith(wxT("innerlink:")) ) { - ShowHtmlText( + HelpSystem::ShowHtmlText( this, TitleText(dhelpURL.Mid( 10 ) ), HelpText( dhelpURL.Mid( 10 )), diff --git a/src/widgets/HelpSystem.cpp b/src/widgets/HelpSystem.cpp index c3a4f95f9..b64ddd6fc 100644 --- a/src/widgets/HelpSystem.cpp +++ b/src/widgets/HelpSystem.cpp @@ -37,7 +37,7 @@ /// Mostly we use this so that we have the code for resizability /// in one place. Other considerations like screen readers are also /// handled by having the code in one place. -void ShowInfoDialog( wxWindow *parent, +void HelpSystem::ShowInfoDialog( wxWindow *parent, const wxString &dlogTitle, const wxString &shortMsg, const wxString &message, @@ -77,7 +77,7 @@ void ShowInfoDialog( wxWindow *parent, dlog.ShowModal(); } -void ShowHtmlText(wxWindow *pParent, +void HelpSystem::ShowHtmlText(wxWindow *pParent, const wxString &Title, const wxString &HtmlText, bool bIsFile = false, bool bModal = false) @@ -164,7 +164,7 @@ void ShowHtmlText(wxWindow *pParent, return; } -void ShowHelpDialog(wxWindow *parent, +void HelpSystem::ShowHelpDialog(wxWindow *parent, const wxString &localFileName, const wxString &remoteURL) { diff --git a/src/widgets/HelpSystem.h b/src/widgets/HelpSystem.h index 0a1760474..fe1d89985 100644 --- a/src/widgets/HelpSystem.h +++ b/src/widgets/HelpSystem.h @@ -18,25 +18,34 @@ class AudacityProject; -/// Displays cutable information in a text ctrl, with an OK button. -void ShowInfoDialog( wxWindow *parent, +/** @brief Class which contains static methods and data needed for implementing + * help buttons + * + * This class should be the only place in the codebase where the location of + * the online copy of the Audacity manual is stored, so that it can be + * changed if required + */ +class HelpSystem +{ +public: + /// Displays cutable information in a text ctrl, with an OK button. + static void ShowInfoDialog( wxWindow *parent, const wxString &dlogTitle, const wxString &shortMsg, const wxString &message, const int xSize, const int ySize); -/// Displays a new window with wxHTML help. -void ShowHtmlText( wxWindow * pParent, + /// Displays a new window with wxHTML help. + static void ShowHtmlText( wxWindow * pParent, const wxString &Title, const wxString &HtmlText, bool bIsFile, bool bModal); -/// Displays a file in your browser, if it's available locally, -/// OR else links to the internet. -void ShowHelpDialog(wxWindow *parent, + /// Displays a file in your browser, if it's available locally, + /// OR else links to the internet. + static void ShowHelpDialog(wxWindow *parent, const wxString &localFileName, const wxString &remoteURL); - - +}; #endif // __AUDACITY_HELPSYSTEM__ diff --git a/src/widgets/LinkingHtmlWindow.cpp b/src/widgets/LinkingHtmlWindow.cpp index a116d7ccc..05079fe2d 100644 --- a/src/widgets/LinkingHtmlWindow.cpp +++ b/src/widgets/LinkingHtmlWindow.cpp @@ -99,7 +99,7 @@ void LinkingHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) wxFileName( FileNames::HtmlHelpDir(), href.Mid( 10 ) + wxT(".htm") ).GetFullPath(); if( wxFileExists( FileName ) ) { - ShowHelpDialog(NULL, FileName, wxT("")); + HelpSystem::ShowHelpDialog(NULL, FileName, wxT("")); return; } else