diff --git a/src/FFmpeg.cpp b/src/FFmpeg.cpp index 4014b3ea6..7bdad10fe 100644 --- a/src/FFmpeg.cpp +++ b/src/FFmpeg.cpp @@ -535,7 +535,7 @@ public: void OnDownload(wxCommandEvent & WXUNUSED(event)) { - HelpSystem::ShowHelpDialog(this, wxT("FAQ:Installation_and_Plug-Ins#ffdown")); + HelpSystem::ShowHelp(this, wxT("FAQ:Installation_and_Plug-Ins#ffdown")); } wxString GetLibPath() diff --git a/src/FreqWindow.cpp b/src/FreqWindow.cpp index 6e09ee13d..f81f4336c 100644 --- a/src/FreqWindow.cpp +++ b/src/FreqWindow.cpp @@ -530,7 +530,7 @@ void FreqWindow::OnGetURL(wxCommandEvent & WXUNUSED(event)) { // Original help page is back on-line (March 2016), but the manual should be more reliable. // http://www.eramp.com/WCAG_2_audio_contrast_tool_help.htm - HelpSystem::ShowHelpDialog(this, wxT("Plot Spectrum")); + HelpSystem::ShowHelp(this, wxT("Plot Spectrum")); } bool FreqWindow::Show(bool show) diff --git a/src/HelpText.cpp b/src/HelpText.cpp index d8130ed1d..57ba1b957 100644 --- a/src/HelpText.cpp +++ b/src/HelpText.cpp @@ -39,7 +39,7 @@ static wxString WrapText( const wxString & Text ) wxT(""); } -static wxString Link( const wxString &Key, const wxString& Text ) +static wxString InnerLink( const wxString &Key, const wxString& Text ) { return wxString(wxT("")) + wxT("") + Text + @@ -126,7 +126,7 @@ static wxString LinkExpand( const wxString & Text ) } else { - Replacement = Link( Key, LinkText ); + Replacement = InnerLink( Key, LinkText ); } @@ -225,8 +225,8 @@ static wxString HelpTextBuiltIn( const wxString & Key ) _(" [[http://www.darkaudacity.com/video.html|Tutorials]] - for getting started with DarkAudacity.") + wxT("") + wxT("

Audacity has these support methods:") + wxT(""); + wxT(" [[https://manual.audacityteam.org/|Manual]] - for comprehensive Audacity documentation") + wxT("
  • ") + + wxT(" [[https://forum.audacityteam.org/|Forum]] - for large knowledge base on using Audacity.") + wxT("
  • "); #else wxT("

    Audacity ") + AUDACITY_VERSION_STRING + wxT("

    ") + _("How to get help") + wxT("

    ") + diff --git a/src/Menus.cpp b/src/Menus.cpp index 84b1a458a..8d905c95e 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -8260,14 +8260,14 @@ void AudacityProject::OnHelpWelcome() void AudacityProject::OnQuickHelp() { - HelpSystem::ShowHelpDialog( + HelpSystem::ShowHelp( this, wxT("Quick_Help")); } void AudacityProject::OnManual() { - HelpSystem::ShowHelpDialog( + HelpSystem::ShowHelp( this, wxT("Main_Page")); } diff --git a/src/TimerRecordDialog.cpp b/src/TimerRecordDialog.cpp index 3dab6035c..54f1e3279 100644 --- a/src/TimerRecordDialog.cpp +++ b/src/TimerRecordDialog.cpp @@ -356,7 +356,7 @@ void TimerRecordDialog::OnAutoExportCheckBox_Change(wxCommandEvent& WXUNUSED(eve void TimerRecordDialog::OnHelpButtonClick(wxCommandEvent& WXUNUSED(event)) { - HelpSystem::ShowHelpDialog(this, wxT("Timer_Record"), true); + HelpSystem::ShowHelp(this, wxT("Timer_Record"), true); } void TimerRecordDialog::OnOK(wxCommandEvent& WXUNUSED(event)) diff --git a/src/commands/CommandManager.cpp b/src/commands/CommandManager.cpp index b3113dfca..cecf579e7 100644 --- a/src/commands/CommandManager.cpp +++ b/src/commands/CommandManager.cpp @@ -95,6 +95,7 @@ CommandManager. It holds the callback for one command. #include "../effects/EffectManager.h" #include "../widgets/LinkingHtmlWindow.h" #include "../widgets/ErrorDialog.h" +#include "../widgets/HelpSystem.h" // On wxGTK, there may be many many many plugins, but the menus don't automatically // allow for scrolling, so we build sub-menus. If the menu gets longer than @@ -1232,7 +1233,7 @@ void CommandManager::TellUserWhyDisallowed( const wxString & Name, CommandFlag f wxString reason = _("There was a problem with your last action. If you think\nthis is a bug, please tell us exactly where it occurred."); // The default title string is 'Disallowed'. wxString title = _("Disallowed"); - wxString help_url =""; + wxString helpPage =""; auto missingFlags = flagsRequired & (~flagsGot ); if( missingFlags & AudioIONotBusyFlag ) @@ -1263,7 +1264,7 @@ void CommandManager::TellUserWhyDisallowed( const wxString & Name, CommandFlag f ), Name ); #endif #endif - help_url = "http://alphamanual.audacityteam.org/man/Selecting_Audio_-_the_basics"; + helpPage = "Selecting_Audio_-_the_basics"; } else if( missingFlags & WaveTracksSelectedFlag) reason = _("You must first select some audio to perform this action.\n(Selecting other kinds of track won't work.)"); @@ -1277,30 +1278,13 @@ void CommandManager::TellUserWhyDisallowed( const wxString & Name, CommandFlag f else if( missingFlags == TrackPanelHasFocus ) return; - -#if 0 // Does not have the warning icon... ShowErrorDialog( NULL, title, reason, - help_url, + helpPage, false); -#endif - - // JKC: I tried building a custom error dialog with the warning icon, and a - // help button linking to our html (without closing). - // In the end I decided it was easier (more portable across different - // OS's) to use the stock one. - int result = ::wxMessageBox(reason, title, wxICON_WARNING | wxOK | - (help_url.IsEmpty() ? 0 : wxHELP) ); - // if they click help, we fetch that help, and pop the dialog (without a - // help button) up again. - if( result == wxHELP ){ - wxHtmlLinkInfo link( help_url ); - OpenInDefaultBrowser(link); - ::wxMessageBox(reason, title, wxICON_WARNING | wxOK ); - } } wxString CommandManager::DescribeCommandsAndShortcuts diff --git a/src/effects/Contrast.cpp b/src/effects/Contrast.cpp index fde290820..96e9b9b9d 100644 --- a/src/effects/Contrast.cpp +++ b/src/effects/Contrast.cpp @@ -323,7 +323,7 @@ void ContrastDialog::OnGetURL(wxCommandEvent & WXUNUSED(event)) { // Original help page is back on-line (March 2016), but the manual should be more reliable. // http://www.eramp.com/WCAG_2_audio_contrast_tool_help.htm - HelpSystem::ShowHelpDialog(this, wxT("Contrast")); + HelpSystem::ShowHelp(this, wxT("Contrast")); } void ContrastDialog::OnClose(wxCommandEvent & WXUNUSED(event)) diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index e26952296..61f7a15d7 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -2625,7 +2625,7 @@ void Effect::Preview(bool dryOnly) else { ShowErrorDialog(FocusDialog, _("Error"), _("Error opening sound device.\nTry changing the audio host, playback device and the project sample rate."), - wxT("http://manual.audacityteam.org/man/faq_errors.html#sound_device"), false); + wxT("faq_errors.html#sound_device"), false); } } } @@ -3245,13 +3245,13 @@ void EffectUIHost::OnCancel(wxCommandEvent & evt) void EffectUIHost::OnHelp(wxCommandEvent & WXUNUSED(event)) { if (mEffect->GetFamily().IsSameAs(NYQUISTEFFECTS_FAMILY) && (mEffect->ManualPage().IsEmpty())) { - // Old ShowHelpDialog required when there is no on-line manual. + // Old ShowHelp required when there is no on-line manual. // Always use default web browser to allow full-featured HTML pages. - HelpSystem::ShowHelpDialog(FindWindow(wxID_HELP), mEffect->HelpPage(), wxEmptyString, true, true); + HelpSystem::ShowHelp(FindWindow(wxID_HELP), mEffect->HelpPage(), wxEmptyString, true, true); } else { - // otherwise use the NEW ShowHelpDialog - HelpSystem::ShowHelpDialog(FindWindow(wxID_HELP), mEffect->ManualPage(), true); + // otherwise use the NEW ShowHelp + HelpSystem::ShowHelp(FindWindow(wxID_HELP), mEffect->ManualPage(), true); } } diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index 933bb9a45..47680fb53 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -3536,7 +3536,8 @@ void EditCurvesDialog::OnExport( wxCommandEvent & WXUNUSED(event)) void EditCurvesDialog::OnLibrary( wxCommandEvent & WXUNUSED(event)) { - wxLaunchDefaultBrowser(wxT("http://wiki.audacityteam.org/wiki/EQCurvesDownload")); + // full path to wiki. + wxLaunchDefaultBrowser(wxT("https://wiki.audacityteam.org/wiki/EQCurvesDownload")); } void EditCurvesDialog::OnDefaults( wxCommandEvent & WXUNUSED(event)) diff --git a/src/export/ExportMP3.cpp b/src/export/ExportMP3.cpp index 897860e42..9a851737a 100644 --- a/src/export/ExportMP3.cpp +++ b/src/export/ExportMP3.cpp @@ -676,7 +676,7 @@ public: void OnDownload(wxCommandEvent & WXUNUSED(event)) { - wxString page = wxT("http://manual.audacityteam.org/man/faq_installation_and_plug_ins.html#lame"); + wxString page = wxT("faq_installation_and_plug_ins.html#lame"); ::OpenInDefaultBrowser(page); } diff --git a/src/prefs/LibraryPrefs.cpp b/src/prefs/LibraryPrefs.cpp index ef233fe83..00ba4673e 100644 --- a/src/prefs/LibraryPrefs.cpp +++ b/src/prefs/LibraryPrefs.cpp @@ -180,7 +180,7 @@ void LibraryPrefs::OnMP3FindButton(wxCommandEvent & WXUNUSED(event)) void LibraryPrefs::OnMP3DownButton(wxCommandEvent & WXUNUSED(event)) { // Modal help dialogue required here - HelpSystem::ShowHelpDialog(this, wxT("FAQ:Installation_and_Plug-Ins#lame"), true); + HelpSystem::ShowHelp(this, wxT("FAQ:Installation_and_Plug-Ins#lame"), true); } void LibraryPrefs::SetFFmpegVersionText() @@ -228,7 +228,7 @@ void LibraryPrefs::OnFFmpegFindButton(wxCommandEvent & WXUNUSED(event)) void LibraryPrefs::OnFFmpegDownButton(wxCommandEvent & WXUNUSED(event)) { - HelpSystem::ShowHelpDialog(this, wxT("FAQ:Installation_and_Plug-Ins#ffdown"), true); + HelpSystem::ShowHelp(this, wxT("FAQ:Installation_and_Plug-Ins#ffdown"), true); } bool LibraryPrefs::Commit() diff --git a/src/prefs/PrefsDialog.cpp b/src/prefs/PrefsDialog.cpp index 6dc20d304..4d912d5da 100644 --- a/src/prefs/PrefsDialog.cpp +++ b/src/prefs/PrefsDialog.cpp @@ -434,7 +434,7 @@ void PrefsDialog::OnHelp(wxCommandEvent & WXUNUSED(event)) // So we change the page name in the case of a page on its own. if( !mCategories) page.Replace( "Spectrograms_Preferences", "Spectrogram_Settings" ); - HelpSystem::ShowHelpDialog(this, page, true); + HelpSystem::ShowHelp(this, page, true); } void PrefsDialog::OnTreeKeyDown(wxTreeEvent & event) diff --git a/src/toolbars/ControlToolBar.cpp b/src/toolbars/ControlToolBar.cpp index 7e92f0333..90c310d8f 100644 --- a/src/toolbars/ControlToolBar.cpp +++ b/src/toolbars/ControlToolBar.cpp @@ -718,7 +718,7 @@ int ControlToolBar::PlayPlayRegion(const SelectedRegion &selectedRegion, // Show error message if stream could not be opened ShowErrorDialog(this, _("Error"), _("Error opening sound device.\nTry changing the audio host, playback device and the project sample rate."), - wxT("http://manual.audacityteam.org/man/faq_errors.html#sound_device"), false); + wxT("faq_errors.html#sound_device"), false); }); } } @@ -1200,7 +1200,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt) // Show error message if stream could not be opened ShowErrorDialog(this, _("Error"), _("Error opening sound device.\nTry changing the audio host, recording device and the project sample rate."), - wxT("http://manual.audacityteam.org/man/faq_errors.html#sound_device"), false); + wxT("faq_errors.html#sound_device"), false); } } } diff --git a/src/widgets/ErrorDialog.cpp b/src/widgets/ErrorDialog.cpp index d7e3f48e9..ad11fe47a 100644 --- a/src/widgets/ErrorDialog.cpp +++ b/src/widgets/ErrorDialog.cpp @@ -76,7 +76,7 @@ ErrorDialog::ErrorDialog( wxWindow *parent, const wxString & dlogTitle, const wxString & message, - const wxString & helpURL, + const wxString & helpPage, const bool Close, const bool modal): wxDialogWrapper(parent, (wxWindowID)-1, dlogTitle) { @@ -85,8 +85,8 @@ ErrorDialog::ErrorDialog( long buttonMask; // only add the help button if we have a URL - buttonMask = (helpURL == wxT("")) ? eOkButton : (eHelpButton | eOkButton); - dhelpURL = helpURL; + buttonMask = (helpPage == wxT("")) ? eOkButton : (eHelpButton | eOkButton); + dhelpPage = helpPage; dClose = Close; dModal = modal; @@ -152,17 +152,18 @@ void ErrorDialog::OnOk(wxCommandEvent & WXUNUSED(event)) void ErrorDialog::OnHelp(wxCommandEvent & WXUNUSED(event)) { - if( dhelpURL.StartsWith(wxT("innerlink:")) ) + if( dhelpPage.StartsWith(wxT("innerlink:")) ) { HelpSystem::ShowHtmlText( this, - TitleText(dhelpURL.Mid( 10 ) ), - HelpText( dhelpURL.Mid( 10 )), + TitleText(dhelpPage.Mid( 10 ) ), + HelpText( dhelpPage.Mid( 10 )), false, true ); return; } - OpenInDefaultBrowser( dhelpURL ); + HelpSystem::ShowHelp( this, dhelpPage, dClose ); + //OpenInDefaultBrowser( dhelpURL ); if(dClose) EndModal(true); } @@ -170,26 +171,31 @@ void ErrorDialog::OnHelp(wxCommandEvent & WXUNUSED(event)) void ShowErrorDialog(wxWindow *parent, const wxString &dlogTitle, const wxString &message, - const wxString &helpURL, + const wxString &helpPage, const bool Close) { - ErrorDialog dlog(parent, dlogTitle, message, helpURL, Close); + ErrorDialog dlog(parent, dlogTitle, message, helpPage, Close); dlog.CentreOnParent(); dlog.ShowModal(); } + +// unused. void ShowModelessErrorDialog(wxWindow *parent, const wxString &dlogTitle, const wxString &message, - const wxString &helpURL, + const wxString &helpPage, const bool Close) { + // ensure it has some parent. + if( !parent ) + parent = wxTheApp->GetTopWindow(); wxASSERT(parent); - ErrorDialog *dlog = safenew ErrorDialog(parent, dlogTitle, message, helpURL, Close, false); + ErrorDialog *dlog = safenew ErrorDialog(parent, dlogTitle, message, helpPage, Close, false); dlog->CentreOnParent(); dlog->Show(); - // ANSWER-ME: Vigilant Sentry flags this method as not deleting dlog, so a mem leak. - // ANSWER-ME: This is unused. Delete it or are there plans for it? + // ANSWER-ME: Vigilant Sentry flagged this method as not deleting dlog, so + // is this actually a mem leak. // PRL: answer is that the parent window guarantees destruction of the dialog // but in practice Destroy() in OnOK does that } @@ -197,11 +203,11 @@ void ShowModelessErrorDialog(wxWindow *parent, void ShowAliasMissingDialog(AudacityProject *parent, const wxString &dlogTitle, const wxString &message, - const wxString &helpURL, + const wxString &helpPage, const bool Close) { wxASSERT(parent); // to justify safenew - ErrorDialog *dlog = safenew AliasedFileMissingDialog(parent, dlogTitle, message, helpURL, Close, false); + ErrorDialog *dlog = safenew AliasedFileMissingDialog(parent, dlogTitle, message, helpPage, Close, false); // Don't center because in many cases (effect, export, etc) there will be a progress bar in the center that blocks this. // instead put it just above or on the top of the project. wxPoint point; diff --git a/src/widgets/ErrorDialog.h b/src/widgets/ErrorDialog.h index 894b94482..73a1b98c6 100644 --- a/src/widgets/ErrorDialog.h +++ b/src/widgets/ErrorDialog.h @@ -26,13 +26,13 @@ public: ErrorDialog(wxWindow *parent, const wxString & dlogTitle, const wxString & message, - const wxString & helpURL, + const wxString & helpPage, const bool Close = true, const bool modal = true); virtual ~ErrorDialog(){} private: - wxString dhelpURL; + wxString dhelpPage; bool dClose; bool dModal; @@ -67,21 +67,21 @@ public: void ShowErrorDialog(wxWindow *parent, const wxString &dlogTitle, const wxString &message, - const wxString &helpURL, + const wxString &helpPage, bool Close = true); /// Displays a modeless error dialog with a button that offers help void ShowModelessErrorDialog(wxWindow *parent, const wxString &dlogTitle, const wxString &message, - const wxString &helpURL, + const wxString &helpPage, bool Close = true); /// Displays a custom modeless error dialog for aliased file errors void ShowAliasMissingDialog(AudacityProject *parent, const wxString &dlogTitle, const wxString &message, - const wxString &helpURL, + const wxString &helpPage, const bool Close = true); #endif // __AUDACITY_ERRORDIALOG__ diff --git a/src/widgets/HelpSystem.cpp b/src/widgets/HelpSystem.cpp index d87d29063..6e772e42b 100644 --- a/src/widgets/HelpSystem.cpp +++ b/src/widgets/HelpSystem.cpp @@ -197,7 +197,8 @@ void HelpSystem::ShowHtmlText(wxWindow *pParent, return; } -void HelpSystem::ShowHelpDialog(wxWindow *parent, +// Shows help in browser, or possibly in own dialog. +void HelpSystem::ShowHelp(wxWindow *parent, const wxString &localFileName, const wxString &remoteURL, bool bModal, @@ -240,7 +241,7 @@ void HelpSystem::ShowHelpDialog(wxWindow *parent, // Always go to remote URL. Use External browser. OpenInDefaultBrowser( remoteURL ); } - else if( !wxFileExists( localfile )) + else if( localfile.IsEmpty() || !wxFileExists( localfile )) { // If you give an empty remote URL, you should have already ensured // that the file exists! @@ -263,9 +264,9 @@ void HelpSystem::ShowHelpDialog(wxWindow *parent, } } -void HelpSystem::ShowHelpDialog(wxWindow *parent, - const wxString &PageName, - bool bModal) +void HelpSystem::ShowHelp(wxWindow *parent, + const wxString &PageName, + bool bModal) { wxString localHelpPage; wxString webHelpPath; @@ -299,7 +300,7 @@ void HelpSystem::ShowHelpDialog(wxWindow *parent, { releasePageName = wxT("index") + HelpSystem::ReleaseSuffix + anchor; localHelpPage = wxFileName(FileNames::HtmlHelpDir(), releasePageName).GetFullPath(); - webHelpPath = wxT("http://")+HelpSystem::HelpHostname+HelpSystem::HelpServerHomeDir; + webHelpPath = wxT("https://")+HelpSystem::HelpHostname+HelpSystem::HelpServerHomeDir; } else if (releasePageName == wxT("Quick_Help")) { @@ -311,9 +312,16 @@ void HelpSystem::ShowHelpDialog(wxWindow *parent, #else releasePageName = wxT("quick_help") + HelpSystem::ReleaseSuffix + anchor; localHelpPage = wxFileName(FileNames::HtmlHelpDir(), releasePageName).GetFullPath(); - webHelpPath = wxT("http://")+HelpSystem::HelpHostname+HelpSystem::HelpServerHomeDir; + webHelpPath = wxT("https://")+HelpSystem::HelpHostname+HelpSystem::HelpServerHomeDir; #endif } + // not a page name, but rather a full path (e.g. to wiki) + // in which case do not do any substitutions. + else if (releasePageName.StartsWith( "http" ) ) + { + localHelpPage = ""; + webHelpPage = releasePageName + anchor; + } else { // Handle all other pages. @@ -343,7 +351,7 @@ void HelpSystem::ShowHelpDialog(wxWindow *parent, // Other than index and quick_help, all local pages are in subdirectory 'LocalHelpManDir'. localHelpPage = wxFileName(FileNames::HtmlHelpDir() + LocalHelpManDir, releasePageName).GetFullPath(); // Other than index and quick_help, all on-line pages are in subdirectory 'HelpServerManDir'. - webHelpPath = wxT("http://")+HelpSystem::HelpHostname+HelpSystem::HelpServerManDir; + webHelpPath = wxT("https://")+HelpSystem::HelpHostname+HelpSystem::HelpServerManDir; } #if IS_ALPHA @@ -359,7 +367,7 @@ void HelpSystem::ShowHelpDialog(wxWindow *parent, wxASSERT(parent); // to justify safenew - HelpSystem::ShowHelpDialog( + HelpSystem::ShowHelp( parent, localHelpPage, webHelpPage, diff --git a/src/widgets/HelpSystem.h b/src/widgets/HelpSystem.h index 04c447863..a12b84c5b 100644 --- a/src/widgets/HelpSystem.h +++ b/src/widgets/HelpSystem.h @@ -59,7 +59,7 @@ public: /// Default is modeless dialogue /// @param alwaysDefaultBrowser Force use of default web browser. /// Default allows built in browser for local files. - static void ShowHelpDialog(wxWindow *parent, + static void ShowHelp(wxWindow *parent, const wxString &localFileName, const wxString &remoteURL, bool bModal = false, @@ -72,7 +72,7 @@ public: /// converted file name used for offline and released manuals. /// @param bModal Whether the resulting dialogue should be modal or not. /// Default is modeless dialogue - static void ShowHelpDialog(wxWindow *parent, + static void ShowHelp(wxWindow *parent, const wxString &PageName, bool bModal = false); diff --git a/src/widgets/LinkingHtmlWindow.cpp b/src/widgets/LinkingHtmlWindow.cpp index 3f0c1c2b8..539e12782 100644 --- a/src/widgets/LinkingHtmlWindow.cpp +++ b/src/widgets/LinkingHtmlWindow.cpp @@ -144,7 +144,7 @@ void LinkingHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) wxFileName( FileNames::HtmlHelpDir(), href.Mid( 10 ) + wxT(".htm") ).GetFullPath(); if( wxFileExists( FileName ) ) { - HelpSystem::ShowHelpDialog(this, FileName, wxT("")); + HelpSystem::ShowHelp(this, FileName, wxT("")); return; } else