diff --git a/common/eda_doc.cpp b/common/eda_doc.cpp index 2a159da22d..0b0c19c52f 100644 --- a/common/eda_doc.cpp +++ b/common/eda_doc.cpp @@ -71,19 +71,14 @@ static const wxFileTypeInfo EDAfallbacks[] = }; -bool GetAssociatedDocument( wxWindow* aParent, const wxString& aDocName, PROJECT* aProject ) +bool GetAssociatedDocument( wxWindow* aParent, const wxString& aDocName, PROJECT* aProject, SEARCH_STACK* aPaths ) { - SEARCH_STACK* aPaths = nullptr; wxString docname; wxString fullfilename; wxString msg; wxString command; bool success = false; -#if defined( EESCHEMA ) - SEARCH_STACK* aPaths = aProject ? aProject->SchSearchS() : nullptr; -#endif - // Is an internet url static const std::vector url_header = { diff --git a/common/widgets/grid_text_button_helpers.cpp b/common/widgets/grid_text_button_helpers.cpp index e667029da9..f7343497c5 100644 --- a/common/widgets/grid_text_button_helpers.cpp +++ b/common/widgets/grid_text_button_helpers.cpp @@ -298,10 +298,11 @@ void GRID_CELL_FOOTPRINT_ID_EDITOR::Create( wxWindow* aParent, wxWindowID aId, class TEXT_BUTTON_URL : public wxComboCtrl { public: - TEXT_BUTTON_URL( wxWindow* aParent, DIALOG_SHIM* aParentDlg ) : + TEXT_BUTTON_URL( wxWindow* aParent, DIALOG_SHIM* aParentDlg, SEARCH_STACK* aSearchStack ) : wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ), - m_dlg( aParentDlg ) + m_dlg( aParentDlg ), + m_searchStack( aSearchStack ) { SetButtonBitmaps( KiBitmap( BITMAPS::www ) ); @@ -320,17 +321,18 @@ protected: wxString filename = GetValue(); if( !filename.IsEmpty() && filename != wxT( "~" ) ) - GetAssociatedDocument( m_dlg, GetValue(), &m_dlg->Prj() ); + GetAssociatedDocument( m_dlg, GetValue(), &m_dlg->Prj(), m_searchStack ); } DIALOG_SHIM* m_dlg; + SEARCH_STACK* m_searchStack; }; void GRID_CELL_URL_EDITOR::Create( wxWindow* aParent, wxWindowID aId, wxEvtHandler* aEventHandler ) { - m_control = new TEXT_BUTTON_URL( aParent, m_dlg ); + m_control = new TEXT_BUTTON_URL( aParent, m_dlg, m_searchStack ); #if wxUSE_VALIDATORS // validate text in textctrl, if validator is set diff --git a/eeschema/dialogs/dialog_lib_symbol_properties.cpp b/eeschema/dialogs/dialog_lib_symbol_properties.cpp index 1aa383597f..809148afc9 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_lib_symbol_properties.cpp @@ -72,7 +72,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* a m_grid->ShowHideColumns( cfg->m_EditSymbolVisibleColumns ); wxGridCellAttr* attr = new wxGridCellAttr; - attr->SetEditor( new GRID_CELL_URL_EDITOR( this ) ); + attr->SetEditor( new GRID_CELL_URL_EDITOR( this, Prj().SchSearchS() ) ); m_grid->SetAttr( DATASHEET_FIELD, FDC_VALUE, attr ); m_SymbolNameCtrl->SetValidator( SCH_FIELD_VALIDATOR( true, VALUE_FIELD ) ); diff --git a/eeschema/dialogs/dialog_symbol_fields_table.cpp b/eeschema/dialogs/dialog_symbol_fields_table.cpp index b2de7f4d85..a30707f1d1 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table.cpp +++ b/eeschema/dialogs/dialog_symbol_fields_table.cpp @@ -119,7 +119,7 @@ protected: { wxString datasheet_uri = m_grid->GetCellValue( m_grid->GetGridCursorRow(), DATASHEET_FIELD ); - GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj() ); + GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj(), m_dlg->Prj().SchSearchS() ); } else { @@ -823,7 +823,7 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent ) // set datasheet column viewer button attr = new wxGridCellAttr; - attr->SetEditor( new GRID_CELL_URL_EDITOR( this ) ); + attr->SetEditor( new GRID_CELL_URL_EDITOR( this, Prj().SchSearchS() ) ); m_grid->SetColAttr( DATASHEET_FIELD, attr ); // set quantities column attributes diff --git a/eeschema/fields_grid_table.cpp b/eeschema/fields_grid_table.cpp index 2a2df29fd5..e93de918c2 100644 --- a/eeschema/fields_grid_table.cpp +++ b/eeschema/fields_grid_table.cpp @@ -152,7 +152,8 @@ void FIELDS_GRID_TABLE::initGrid( WX_GRID* aGrid ) m_footprintAttr->SetEditor( fpIdEditor ); m_urlAttr = new wxGridCellAttr; - GRID_CELL_URL_EDITOR* urlEditor = new GRID_CELL_URL_EDITOR( m_dialog ); + GRID_CELL_URL_EDITOR* urlEditor = + new GRID_CELL_URL_EDITOR( m_dialog, m_frame->Prj().SchSearchS() ); urlEditor->SetValidator( m_urlValidator ); m_urlAttr->SetEditor( urlEditor ); @@ -776,7 +777,7 @@ void FIELDS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event ) else if (event.GetId() == MYID_SHOW_DATASHEET ) { wxString datasheet_uri = m_grid->GetCellValue( DATASHEET_FIELD, FDC_VALUE ); - GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj() ); + GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj(), m_dlg->Prj().SchSearchS() ); } else { diff --git a/eeschema/tools/ee_inspection_tool.cpp b/eeschema/tools/ee_inspection_tool.cpp index 76797a4895..1a705d41fe 100644 --- a/eeschema/tools/ee_inspection_tool.cpp +++ b/eeschema/tools/ee_inspection_tool.cpp @@ -297,7 +297,7 @@ int EE_INSPECTION_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent ) } else { - GetAssociatedDocument( m_frame, datasheet, &m_frame->Prj() ); + GetAssociatedDocument( m_frame, datasheet, &m_frame->Prj(), m_frame->Prj().SchSearchS() ); } return 0; diff --git a/include/eda_doc.h b/include/eda_doc.h index c01c351b30..e3caecd4a9 100644 --- a/include/eda_doc.h +++ b/include/eda_doc.h @@ -40,8 +40,10 @@ * * @param aParent main frame. * @param aDocName filename of file to open (Full filename or short filename). + * @param aPaths Additional paths to search for local disk datasheet files */ -bool GetAssociatedDocument( wxWindow* aParent, const wxString& aDocName, PROJECT* aProject ); +bool GetAssociatedDocument( wxWindow* aParent, const wxString& aDocName, PROJECT* aProject, + SEARCH_STACK* aPaths = nullptr ); #endif /* __INCLUDE__EDA_DOC_H__ */ diff --git a/include/widgets/grid_text_button_helpers.h b/include/widgets/grid_text_button_helpers.h index a446edc2bc..df5c64edcf 100644 --- a/include/widgets/grid_text_button_helpers.h +++ b/include/widgets/grid_text_button_helpers.h @@ -114,8 +114,8 @@ protected: class GRID_CELL_URL_EDITOR : public GRID_CELL_TEXT_BUTTON { public: - GRID_CELL_URL_EDITOR( DIALOG_SHIM* aParent ) : - m_dlg( aParent ) + GRID_CELL_URL_EDITOR( DIALOG_SHIM* aParent, SEARCH_STACK* aSearchStack = nullptr ) : + m_dlg( aParent ), m_searchStack( aSearchStack ) { } wxGridCellEditor* Clone() const override @@ -127,6 +127,7 @@ public: protected: DIALOG_SHIM* m_dlg; + SEARCH_STACK* m_searchStack; };