LIB_TREE: use GetAssociatedDocument() to display the doc from a wxHtmlLinkEvent

One cannot always use the string given in the wxHtmlLinkEvent without expanding
Env Vars.
Fixes #15984
https://gitlab.com/kicad/code/kicad/-/issues/15984
This commit is contained in:
jean-pierre charras 2023-10-30 11:27:08 +01:00
parent 4b083fc342
commit 0f2beed54a
1 changed files with 8 additions and 2 deletions

View File

@ -37,7 +37,10 @@
#include <wx/sizer.h>
#include <wx/srchctrl.h>
#include <wx/popupwin.h>
#include "wx/app.h"
#include <eda_doc.h> // for GetAssociatedDocument()
#include <pgm_base.h> // for PROJECT
#include <settings/settings_manager.h> // for PROJECT
constexpr int RECENT_SEARCHES_MAX = 10;
@ -808,7 +811,10 @@ void LIB_TREE::onTreeActivate( wxDataViewEvent& aEvent )
void LIB_TREE::onDetailsLink( wxHtmlLinkEvent& aEvent )
{
const wxHtmlLinkInfo& info = aEvent.GetLinkInfo();
::wxLaunchDefaultBrowser( info.GetHref() );
wxString docname = info.GetHref();
PROJECT& prj = Pgm().GetSettingsManager().Prj();
GetAssociatedDocument( this, docname, &prj );
}