"Show Datasheet" button: Resolve env-vars (like ${KIPRJMOD}) if appears.
This way, the datasheets can be stored within the project dir, and referred as ${KIPRJMOD}/relative/path/to/datasheet.
This commit is contained in:
parent
79823d573a
commit
521e18ddbd
|
@ -38,6 +38,8 @@ Chris Pavlina <pavlina.chris[at]gmail-dot-com>
|
|||
Simon Richter <Simon.Richter[at]hogyros-dot-de>
|
||||
Mario Luzeiro <mrluzeiro[at]ua-dot-pt>
|
||||
Mateusz Skowroński <skowri[at]gmail-dot-com>
|
||||
Cheng Sheng <chengsheng[at]google-dot-com>
|
||||
Google Inc.
|
||||
See also CHANGELOG.txt for contributors.
|
||||
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include <wx/tooltip.h>
|
||||
#include <wx/hyperlink.h>
|
||||
#include <wx/url.h>
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <pgm_base.h>
|
||||
|
@ -51,6 +52,8 @@
|
|||
#include <netlist_exporter_pspice.h>
|
||||
#endif /* KICAD_SPICE */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
|
||||
/**
|
||||
* class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
|
||||
|
@ -554,6 +557,18 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::deleteFieldButtonHandler( wxCommandEven
|
|||
m_skipCopyFromPanel = false;
|
||||
}
|
||||
|
||||
static wxString resolveUriByEnvVars( const wxString& aUri )
|
||||
{
|
||||
// URL-like URI: return as is.
|
||||
wxURL url( aUri );
|
||||
if( url.GetError() == wxURL_NOERR )
|
||||
{
|
||||
return aUri;
|
||||
}
|
||||
// Otherwise, the path points to a local file. Resolve environment
|
||||
// variables if any.
|
||||
return ExpandEnvVarSubstitutions( aUri );
|
||||
}
|
||||
|
||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler( wxCommandEvent& event )
|
||||
{
|
||||
|
@ -562,6 +577,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler( wxCommandEvent& even
|
|||
if( fieldNdx == DATASHEET )
|
||||
{
|
||||
wxString datasheet_uri = fieldValueTextCtrl->GetValue();
|
||||
datasheet_uri = resolveUriByEnvVars( datasheet_uri );
|
||||
::wxLaunchDefaultBrowser( datasheet_uri );
|
||||
}
|
||||
else if( fieldNdx == FOOTPRINT )
|
||||
|
|
Loading…
Reference in New Issue