Fix eda_doc not looking for schematic locally

It looks like this was overlooked by Jeff in 2020 not realizing eda_doc isn't built under eeschema but common in cc9ac37a0e
This commit is contained in:
Marek Roszko 2022-05-10 21:28:48 -04:00
parent 37838dffb9
commit f85251ef75
8 changed files with 20 additions and 19 deletions

View File

@ -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 docname;
wxString fullfilename; wxString fullfilename;
wxString msg; wxString msg;
wxString command; wxString command;
bool success = false; bool success = false;
#if defined( EESCHEMA )
SEARCH_STACK* aPaths = aProject ? aProject->SchSearchS() : nullptr;
#endif
// Is an internet url // Is an internet url
static const std::vector<wxString> url_header = static const std::vector<wxString> url_header =
{ {

View File

@ -298,10 +298,11 @@ void GRID_CELL_FOOTPRINT_ID_EDITOR::Create( wxWindow* aParent, wxWindowID aId,
class TEXT_BUTTON_URL : public wxComboCtrl class TEXT_BUTTON_URL : public wxComboCtrl
{ {
public: 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, wxComboCtrl( aParent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_PROCESS_ENTER ), wxTE_PROCESS_ENTER ),
m_dlg( aParentDlg ) m_dlg( aParentDlg ),
m_searchStack( aSearchStack )
{ {
SetButtonBitmaps( KiBitmap( BITMAPS::www ) ); SetButtonBitmaps( KiBitmap( BITMAPS::www ) );
@ -320,17 +321,18 @@ protected:
wxString filename = GetValue(); wxString filename = GetValue();
if( !filename.IsEmpty() && filename != wxT( "~" ) ) 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; DIALOG_SHIM* m_dlg;
SEARCH_STACK* m_searchStack;
}; };
void GRID_CELL_URL_EDITOR::Create( wxWindow* aParent, wxWindowID aId, void GRID_CELL_URL_EDITOR::Create( wxWindow* aParent, wxWindowID aId,
wxEvtHandler* aEventHandler ) 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 #if wxUSE_VALIDATORS
// validate text in textctrl, if validator is set // validate text in textctrl, if validator is set

View File

@ -72,7 +72,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* a
m_grid->ShowHideColumns( cfg->m_EditSymbolVisibleColumns ); m_grid->ShowHideColumns( cfg->m_EditSymbolVisibleColumns );
wxGridCellAttr* attr = new wxGridCellAttr; 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_grid->SetAttr( DATASHEET_FIELD, FDC_VALUE, attr );
m_SymbolNameCtrl->SetValidator( SCH_FIELD_VALIDATOR( true, VALUE_FIELD ) ); m_SymbolNameCtrl->SetValidator( SCH_FIELD_VALIDATOR( true, VALUE_FIELD ) );

View File

@ -119,7 +119,7 @@ protected:
{ {
wxString datasheet_uri = m_grid->GetCellValue( m_grid->GetGridCursorRow(), wxString datasheet_uri = m_grid->GetCellValue( m_grid->GetGridCursorRow(),
DATASHEET_FIELD ); DATASHEET_FIELD );
GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj() ); GetAssociatedDocument( m_dlg, datasheet_uri, &m_dlg->Prj(), m_dlg->Prj().SchSearchS() );
} }
else else
{ {
@ -823,7 +823,7 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent )
// set datasheet column viewer button // set datasheet column viewer button
attr = new wxGridCellAttr; 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 ); m_grid->SetColAttr( DATASHEET_FIELD, attr );
// set quantities column attributes // set quantities column attributes

View File

@ -152,7 +152,8 @@ void FIELDS_GRID_TABLE<T>::initGrid( WX_GRID* aGrid )
m_footprintAttr->SetEditor( fpIdEditor ); m_footprintAttr->SetEditor( fpIdEditor );
m_urlAttr = new wxGridCellAttr; 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 ); urlEditor->SetValidator( m_urlValidator );
m_urlAttr->SetEditor( urlEditor ); m_urlAttr->SetEditor( urlEditor );
@ -776,7 +777,7 @@ void FIELDS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
else if (event.GetId() == MYID_SHOW_DATASHEET ) else if (event.GetId() == MYID_SHOW_DATASHEET )
{ {
wxString datasheet_uri = m_grid->GetCellValue( DATASHEET_FIELD, FDC_VALUE ); 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 else
{ {

View File

@ -297,7 +297,7 @@ int EE_INSPECTION_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent )
} }
else else
{ {
GetAssociatedDocument( m_frame, datasheet, &m_frame->Prj() ); GetAssociatedDocument( m_frame, datasheet, &m_frame->Prj(), m_frame->Prj().SchSearchS() );
} }
return 0; return 0;

View File

@ -40,8 +40,10 @@
* *
* @param aParent main frame. * @param aParent main frame.
* @param aDocName filename of file to open (Full filename or short filename). * @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__ */ #endif /* __INCLUDE__EDA_DOC_H__ */

View File

@ -114,8 +114,8 @@ protected:
class GRID_CELL_URL_EDITOR : public GRID_CELL_TEXT_BUTTON class GRID_CELL_URL_EDITOR : public GRID_CELL_TEXT_BUTTON
{ {
public: public:
GRID_CELL_URL_EDITOR( DIALOG_SHIM* aParent ) : GRID_CELL_URL_EDITOR( DIALOG_SHIM* aParent, SEARCH_STACK* aSearchStack = nullptr ) :
m_dlg( aParent ) m_dlg( aParent ), m_searchStack( aSearchStack )
{ } { }
wxGridCellEditor* Clone() const override wxGridCellEditor* Clone() const override
@ -127,6 +127,7 @@ public:
protected: protected:
DIALOG_SHIM* m_dlg; DIALOG_SHIM* m_dlg;
SEARCH_STACK* m_searchStack;
}; };