54 int i = text.Find(
QUOTE );
56 if( wxNOT_FOUND == i )
59 wxString shrt = text.Mid( i + 1 );
60 i = shrt.Find(
QUOTE );
62 if( wxNOT_FOUND == i )
65 text = shrt.Mid( i + 1 );
66 return shrt.Mid( 0, i );
80 wxString* aErrorMessages )
86 wxString tmp, error_msg;
95 fn = wxExpandEnvVars( equfile );
105 error_msg.Printf(
_(
"Equivalence file \"%s\" could not be found in the " 106 "default search paths." ),
109 if( ! aErrorMessages->IsEmpty() )
110 *aErrorMessages << wxT(
"\n\n");
112 *aErrorMessages += error_msg;
118 file = wxFopen( tmp, wxT(
"rt" ) );
126 error_msg.Printf(
_(
"Error opening equivalence file \"%s\"." ), tmp );
128 if( ! aErrorMessages->IsEmpty() )
129 *aErrorMessages << wxT(
"\n\n");
131 *aErrorMessages += error_msg;
145 if( value.IsEmpty() )
150 if( footprint.IsEmpty() )
153 value.Replace( wxT(
" " ), wxT(
"_" ) );
158 aList.push_back( equivItem );
178 wxMessageBox( error_msg,
_(
"Equivalence File Load Error" ), wxOK | wxICON_WARNING, this );
185 msg.Printf(
_(
"%lu footprint/symbol equivalences found." ), (
unsigned long)equivList.size() );
192 bool firstAssoc =
true;
206 wxString fpid_candidate;
208 for(
unsigned idx = 0; idx < equivList.size(); idx++ )
217 bool equ_is_unique =
true;
218 unsigned next = idx+1;
219 int previous = idx-1;
221 if(
next < equivList.size()
224 equ_is_unique =
false;
230 equ_is_unique =
false;
234 if( fp && equ_is_unique )
245 if( fp && fpid_candidate.IsEmpty() )
254 found = ( 0 == filtercount );
256 for(
size_t jj = 0; jj < filtercount && !found; jj++ )
261 msg.Printf(
_(
"Component %s: footprint %s not found in any of the project " 262 "footprint libraries." ),
265 if( ! error_msg.IsEmpty() )
266 error_msg << wxT(
"\n\n");
284 else if( !fpid_candidate.IsEmpty() )
305 if( !error_msg.IsEmpty() )
306 wxMessageBox( error_msg,
_(
"CvPcb Warning" ), wxOK | wxICON_WARNING, this );
void AutomaticFootprintMatching()
Called by the automatic association button Read *.equ files to try to find corresponding footprint fo...
wxString FindValidPath(const wxString &aFileName) const
FOOTPRINT_LIST * m_FootprintsList
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
COMPONENTS_LISTBOX * m_compListBox
virtual PROJECT_FILE & GetProjectFile() const
void AssociateFootprint(const CVPCB_ASSOCIATION &aAssociation, bool aNewEntry=true, bool aAddUndoItem=true)
Associate a footprint with a specific component in the list.
unsigned GetCount() const
Function GetCount.
bool m_skipComponentSelect
Look for files in a number of paths.
PROJECT_FILE is the backing store for a PROJECT, in JSON format.
This file contains miscellaneous commonly used macros and functions.
const LIB_ID & GetFPID() const
SEARCH_STACK & KifaceSearch()
Only for DSO specific 'non-library' files.
boost::ptr_vector< FOOTPRINT_EQUIVALENCE > FOOTPRINT_EQUIVALENCE_LIST
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
const wxString & GetReference() const
std::vector< wxString > m_EquivalenceFiles
CvPcb params.
void SetStatusText(const wxString &aText, int aNumber=0) override
bool sortListbyCmpValue(const FOOTPRINT_EQUIVALENCE &ref, const FOOTPRINT_EQUIVALENCE &test)
COMPONENT is used to store components and all of their related information found in a netlist.
int buildEquivalenceList(FOOTPRINT_EQUIVALENCE_LIST &aList, wxString *aErrorMessages=NULL)
read the .equ files and populate the list of equvalents
COMPONENT * GetComponent(unsigned aIndex)
Function GetComponent returns the COMPONENT at aIndex.
wxString GetQuotedText(wxString &text)
char * GetLine(FILE *File, char *Line, int *LineNum, int SizeLine)
Read one line line from aFile.
A class to define a footprint association to be made in cvpcb.
bool IsEmpty() const
Function IsEmpty()
const wxString & GetValue() const
const wxArrayString & GetFootprintFilters() const