From 80ef42433899446f6fc11701a961fb0a5f66290e Mon Sep 17 00:00:00 2001 From: James Crook Date: Tue, 20 Aug 2019 22:29:18 +0100 Subject: [PATCH] Bug 169 - Welcome Message: Local links to "Quick Help" and "Manual" do nothing if help is not installed. --- src/HelpText.cpp | 9 ++++----- src/widgets/HelpSystem.cpp | 24 +++++++++++++++++------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/HelpText.cpp b/src/HelpText.cpp index 6b28cea00..3bd0aec8b 100644 --- a/src/HelpText.cpp +++ b/src/HelpText.cpp @@ -210,9 +210,8 @@ static wxString HelpTextBuiltIn( const wxString & Key ) if (Key == wxT("welcome")) { - /// TO-DO: Make the links to help here use the widgets/HelpSystem mechanism - /// so that they are consistent - /* i18n-hint: Preserve [[file:quick_help.html as it's the name of a file.*/ + /* i18n-hint: Preserve '[[help:Quick_Help|' as it's the name of a link.*/ + /* i18n-hint: Preserve '[[help:Main_Page|' as it's the name of a link.*/ wxString result = wxString(wxT("")) + #if defined(IS_ALPHA) || defined(IS_BETA) @@ -244,8 +243,8 @@ static wxString HelpTextBuiltIn( const wxString & Key ) wxT("

Audacity ") + AUDACITY_VERSION_STRING + wxT("

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

") + _("These are our support methods:") + wxT("

") + wxT("") + _("More: Visit our [[https://wiki.audacityteam.org/index.php|Wiki]] for tips, tricks, extra tutorials and effects plug-ins.") + wxT("

"); #endif diff --git a/src/widgets/HelpSystem.cpp b/src/widgets/HelpSystem.cpp index d3c83378b..b4ea91ee3 100644 --- a/src/widgets/HelpSystem.cpp +++ b/src/widgets/HelpSystem.cpp @@ -524,7 +524,13 @@ LinkingHtmlWindow::LinkingHtmlWindow(wxWindow *parent, wxWindowID id /*= -1*/, void LinkingHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) { wxString href = link.GetHref(); - if( href.StartsWith(wxT("innerlink:")) ) + + if( href.StartsWith( wxT("innerlink:help:"))) + { + HelpSystem::ShowHelp(this, href.Mid( 15 ), true ); + return; + } + else if( href.StartsWith(wxT("innerlink:")) ) { wxString FileName = wxFileName( FileNames::HtmlHelpDir(), href.Mid( 10 ) + wxT(".htm") ).GetFullPath(); @@ -553,10 +559,14 @@ void LinkingHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) OpenInDefaultBrowser(link); return; } - BrowserDialog * pDlg = wxDynamicCast( - GetRelatedFrame()->FindWindow(BrowserDialog::ID), BrowserDialog ); - if( pDlg ) - { - pDlg->UpdateButtons(); - }; + wxFrame * pFrame = GetRelatedFrame(); + if( !pFrame ) + return; + wxWindow * pWnd = pFrame->FindWindow(BrowserDialog::ID); + if( !pWnd ) + return; + BrowserDialog * pDlg = wxDynamicCast( pWnd , BrowserDialog ); + if( !pDlg ) + return; + pDlg->UpdateButtons(); }