2013-04-25 16:29:35 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2017-03-23 00:59:25 +00:00
|
|
|
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
2013-04-25 16:29:35 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
/**
|
|
|
|
* @file autosel.cpp
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2015-01-13 08:05:43 +00:00
|
|
|
// This file handle automatic selection of footprints, from .equ files which give
|
2016-11-20 23:35:08 +00:00
|
|
|
// a footprint LIB_ID associated to a component value.
|
2015-09-21 20:39:59 +00:00
|
|
|
// These associations have this form:
|
2015-01-13 08:05:43 +00:00
|
|
|
// 'FT232BL' 'QFP:LQFP-32_7x7mm_Pitch0.8mm'
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <common.h>
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
#include <kiface_i.h>
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#include <project.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <gestfich.h>
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#include <pgm_base.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <kicad_string.h>
|
|
|
|
#include <macros.h>
|
|
|
|
|
|
|
|
#include <cvpcb.h>
|
|
|
|
#include <cvpcb_mainframe.h>
|
2016-02-25 09:52:29 +00:00
|
|
|
#include <listview_classes.h>
|
2015-01-13 08:05:43 +00:00
|
|
|
#include <autosel.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
#define QUOTE '\''
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-04-23 15:02:18 +00:00
|
|
|
/*
|
|
|
|
* read the string between quotes and put it in aTarget
|
|
|
|
* put text in aTarget
|
2015-09-21 20:39:59 +00:00
|
|
|
* return a pointer to the last read char (the second quote if OK)
|
2009-04-23 15:02:18 +00:00
|
|
|
*/
|
2011-06-10 14:33:52 +00:00
|
|
|
wxString GetQuotedText( wxString & text )
|
2009-04-23 15:02:18 +00:00
|
|
|
{
|
2011-06-10 14:33:52 +00:00
|
|
|
int i = text.Find( QUOTE );
|
2013-04-25 16:29:35 +00:00
|
|
|
|
|
|
|
if( wxNOT_FOUND == i )
|
|
|
|
return wxT( "" );
|
|
|
|
|
2011-06-10 14:33:52 +00:00
|
|
|
wxString shrt = text.Mid( i + 1 );
|
|
|
|
i = shrt.Find( QUOTE );
|
2013-04-25 16:29:35 +00:00
|
|
|
|
|
|
|
if( wxNOT_FOUND == i )
|
|
|
|
return wxT( "" );
|
|
|
|
|
2011-06-10 14:33:52 +00:00
|
|
|
text = shrt.Mid( i + 1 );
|
|
|
|
return shrt.Mid( 0, i );
|
2009-04-23 15:02:18 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2015-01-13 08:05:43 +00:00
|
|
|
// A sort compare function, used to sort a FOOTPRINT_EQUIVALENCE_LIST by cmp values
|
|
|
|
// (m_ComponentValue member)
|
|
|
|
bool sortListbyCmpValue( const FOOTPRINT_EQUIVALENCE& ref, const FOOTPRINT_EQUIVALENCE& test )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2015-01-13 08:05:43 +00:00
|
|
|
return ref.m_ComponentValue.Cmp( test.m_ComponentValue ) >= 0;
|
|
|
|
}
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2015-09-21 20:39:59 +00:00
|
|
|
|
|
|
|
// read the .equ files and populate the list of equivalents
|
2015-01-13 08:05:43 +00:00
|
|
|
int CVPCB_MAINFRAME::buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wxString * aErrorMessages )
|
|
|
|
{
|
|
|
|
char Line[1024];
|
|
|
|
int error_count = 0;
|
|
|
|
FILE* file;
|
|
|
|
wxFileName fn;
|
|
|
|
wxString tmp, error_msg;
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2015-01-13 08:05:43 +00:00
|
|
|
SEARCH_STACK& search = Kiface().KifaceSearch();
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2015-01-13 08:05:43 +00:00
|
|
|
// Find equivalences in all available files, and populates the
|
|
|
|
// equiv_List with all equivalences found in .equ files
|
|
|
|
for( unsigned ii = 0; ii < m_EquFilesNames.GetCount(); ii++ )
|
2009-04-05 20:49:15 +00:00
|
|
|
{
|
2015-01-13 08:05:43 +00:00
|
|
|
fn = wxExpandEnvVars( m_EquFilesNames[ii] );
|
2014-07-05 20:42:59 +00:00
|
|
|
|
2014-04-08 04:55:53 +00:00
|
|
|
tmp = search.FindValidPath( fn.GetFullPath() );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
|
|
|
if( !tmp )
|
|
|
|
{
|
2015-01-13 08:05:43 +00:00
|
|
|
error_count++;
|
|
|
|
|
|
|
|
if( aErrorMessages )
|
|
|
|
{
|
2015-09-21 20:39:59 +00:00
|
|
|
error_msg.Printf( _( "Equivalence file '%s' could not be found in the "
|
2015-01-13 08:05:43 +00:00
|
|
|
"default search paths." ),
|
|
|
|
GetChars( fn.GetFullName() ) );
|
|
|
|
|
|
|
|
if( ! aErrorMessages->IsEmpty() )
|
|
|
|
*aErrorMessages << wxT("\n\n");
|
|
|
|
|
|
|
|
*aErrorMessages += error_msg;
|
|
|
|
}
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
file = wxFopen( tmp, wxT( "rt" ) );
|
|
|
|
|
|
|
|
if( file == NULL )
|
|
|
|
{
|
2015-01-13 08:05:43 +00:00
|
|
|
error_count++;
|
|
|
|
|
|
|
|
if( aErrorMessages )
|
|
|
|
{
|
2015-09-21 20:39:59 +00:00
|
|
|
error_msg.Printf( _( "Error opening equivalence file '%s'." ), GetChars( tmp ) );
|
2015-01-13 08:05:43 +00:00
|
|
|
|
|
|
|
if( ! aErrorMessages->IsEmpty() )
|
|
|
|
*aErrorMessages << wxT("\n\n");
|
|
|
|
|
|
|
|
*aErrorMessages += error_msg;
|
|
|
|
}
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-05-06 11:55:36 +00:00
|
|
|
while( GetLine( file, Line, NULL, sizeof(Line) ) != NULL )
|
2009-04-05 20:49:15 +00:00
|
|
|
{
|
2009-05-06 11:55:36 +00:00
|
|
|
char* text = Line;
|
2011-06-10 14:33:52 +00:00
|
|
|
wxString value, footprint, wtext = FROM_UTF8( Line );
|
2009-05-06 11:55:36 +00:00
|
|
|
|
2011-06-10 14:33:52 +00:00
|
|
|
value = GetQuotedText( wtext );
|
2009-04-21 17:56:27 +00:00
|
|
|
|
2009-05-06 11:55:36 +00:00
|
|
|
if( text == NULL || ( *text == 0 ) || value.IsEmpty() )
|
2009-04-21 17:56:27 +00:00
|
|
|
continue;
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2011-06-10 14:33:52 +00:00
|
|
|
footprint = GetQuotedText( wtext );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2009-05-06 11:55:36 +00:00
|
|
|
if( footprint.IsEmpty() )
|
|
|
|
continue;
|
2009-04-21 17:56:27 +00:00
|
|
|
|
2011-06-10 14:33:52 +00:00
|
|
|
value.Replace( wxT( " " ), wxT( "_" ) );
|
|
|
|
|
2015-01-13 08:05:43 +00:00
|
|
|
FOOTPRINT_EQUIVALENCE* equivItem = new FOOTPRINT_EQUIVALENCE();
|
|
|
|
equivItem->m_ComponentValue = value;
|
|
|
|
equivItem->m_FootprintFPID = footprint;
|
|
|
|
aList.push_back( equivItem );
|
2009-04-05 20:49:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fclose( file );
|
|
|
|
}
|
|
|
|
|
2015-01-13 08:05:43 +00:00
|
|
|
return error_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::AutomaticFootprintMatching( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
FOOTPRINT_EQUIVALENCE_LIST equiv_List;
|
|
|
|
COMPONENT* component;
|
|
|
|
wxString msg, error_msg;
|
|
|
|
size_t ii;
|
|
|
|
|
|
|
|
if( m_netlist.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( buildEquivalenceList( equiv_List, &error_msg ) )
|
2015-09-21 20:39:59 +00:00
|
|
|
wxMessageBox( error_msg, _( "Equivalence File Load Error" ), wxOK | wxICON_WARNING, this );
|
2015-01-13 08:05:43 +00:00
|
|
|
|
|
|
|
// Sort the association list by component value.
|
|
|
|
// When sorted, find duplicate definitions (i.e. 2 or more items
|
|
|
|
// having the same component value) is more easy.
|
|
|
|
std::sort( equiv_List.begin(), equiv_List.end(), sortListbyCmpValue );
|
|
|
|
|
|
|
|
// Display the number of footprint/component equivalences.
|
2015-09-21 20:39:59 +00:00
|
|
|
msg.Printf( _( "%lu footprint/cmp equivalences found." ), (unsigned long)equiv_List.size() );
|
2009-04-21 17:56:27 +00:00
|
|
|
SetStatusText( msg, 0 );
|
|
|
|
|
2015-09-21 20:39:59 +00:00
|
|
|
// Now, associate each free component with a footprint, when the association
|
2015-01-13 08:05:43 +00:00
|
|
|
// is found in list
|
2012-05-25 06:58:52 +00:00
|
|
|
m_skipComponentSelect = true;
|
2009-05-06 11:55:36 +00:00
|
|
|
ii = 0;
|
2015-01-13 08:05:43 +00:00
|
|
|
error_msg.Empty();
|
2013-04-25 16:29:35 +00:00
|
|
|
|
|
|
|
for( unsigned kk = 0; kk < m_netlist.GetCount(); kk++ )
|
2009-04-05 20:49:15 +00:00
|
|
|
{
|
2013-04-25 16:29:35 +00:00
|
|
|
component = m_netlist.GetComponent( kk );
|
|
|
|
|
2011-10-20 11:28:37 +00:00
|
|
|
bool found = false;
|
2014-07-05 20:42:59 +00:00
|
|
|
m_compListBox->SetSelection( ii++, true );
|
2009-05-06 11:55:36 +00:00
|
|
|
|
2015-01-13 08:05:43 +00:00
|
|
|
if( !component->GetFPID().empty() ) // the component has already a footprint
|
2009-05-06 11:55:36 +00:00
|
|
|
continue;
|
2009-04-23 15:02:18 +00:00
|
|
|
|
2015-01-13 08:05:43 +00:00
|
|
|
// Here a first attempt is made. We can have multiple equivItem of the same value.
|
|
|
|
// When happens, using the footprint filter of components can remove the ambiguity by
|
|
|
|
// filtering equivItem so one can use multiple equiv_List (for polar and
|
2015-09-21 20:39:59 +00:00
|
|
|
// non-polar caps for example)
|
2015-01-13 08:05:43 +00:00
|
|
|
for( unsigned idx = 0; idx < equiv_List.size(); idx++ )
|
2009-04-23 15:02:18 +00:00
|
|
|
{
|
2015-01-13 08:05:43 +00:00
|
|
|
FOOTPRINT_EQUIVALENCE& equivItem = equiv_List[idx];
|
2011-08-29 19:50:05 +00:00
|
|
|
|
2015-01-13 08:05:43 +00:00
|
|
|
if( equivItem.m_ComponentValue.CmpNoCase( component->GetValue() ) != 0 )
|
2009-05-06 11:55:36 +00:00
|
|
|
continue;
|
2009-04-23 15:02:18 +00:00
|
|
|
|
2017-03-23 00:59:25 +00:00
|
|
|
const FOOTPRINT_INFO *module = m_FootprintsList->GetModuleInfo( equivItem.m_FootprintFPID );
|
2015-01-13 08:05:43 +00:00
|
|
|
|
|
|
|
bool equ_is_unique = true;
|
|
|
|
unsigned next = idx+1;
|
2015-01-19 19:03:50 +00:00
|
|
|
int previous = idx-1;
|
2015-01-13 08:05:43 +00:00
|
|
|
|
2015-01-13 08:33:17 +00:00
|
|
|
if( next < equiv_List.size() &&
|
|
|
|
equivItem.m_ComponentValue == equiv_List[next].m_ComponentValue )
|
|
|
|
equ_is_unique = false;
|
|
|
|
|
|
|
|
if( previous >= 0 &&
|
|
|
|
equivItem.m_ComponentValue == equiv_List[previous].m_ComponentValue )
|
2015-01-13 08:05:43 +00:00
|
|
|
equ_is_unique = false;
|
2011-06-10 14:33:52 +00:00
|
|
|
|
2015-01-13 08:05:43 +00:00
|
|
|
// If the equivalence is unique, no ambiguity: use the association
|
|
|
|
if( module && equ_is_unique )
|
|
|
|
{
|
|
|
|
SetNewPkg( equivItem.m_FootprintFPID );
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The equivalence is not unique: use the footprint filter to try to remove
|
|
|
|
// ambiguity
|
2011-06-10 14:33:52 +00:00
|
|
|
if( module )
|
|
|
|
{
|
2013-04-25 16:29:35 +00:00
|
|
|
size_t filtercount = component->GetFootprintFilters().GetCount();
|
2011-06-10 14:33:52 +00:00
|
|
|
found = ( 0 == filtercount ); // if no entries, do not filter
|
2009-04-23 15:02:18 +00:00
|
|
|
|
2011-06-12 16:38:43 +00:00
|
|
|
for( size_t jj = 0; jj < filtercount && !found; jj++ )
|
2011-06-10 14:33:52 +00:00
|
|
|
{
|
2013-12-12 16:01:03 +00:00
|
|
|
found = module->GetFootprintName().Matches( component->GetFootprintFilters()[jj] );
|
2011-06-10 14:33:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2009-05-06 11:55:36 +00:00
|
|
|
{
|
2013-04-25 16:29:35 +00:00
|
|
|
msg.Printf( _( "Component %s: footprint %s not found in any of the project "
|
|
|
|
"footprint libraries." ),
|
|
|
|
GetChars( component->GetReference() ),
|
2015-01-13 08:05:43 +00:00
|
|
|
GetChars( equivItem.m_FootprintFPID ) );
|
|
|
|
|
|
|
|
if( ! error_msg.IsEmpty() )
|
|
|
|
error_msg << wxT("\n\n");
|
|
|
|
|
|
|
|
error_msg += msg;
|
2009-04-23 15:02:18 +00:00
|
|
|
}
|
2013-04-25 16:29:35 +00:00
|
|
|
|
2011-06-10 14:33:52 +00:00
|
|
|
if( found )
|
|
|
|
{
|
2015-01-13 08:05:43 +00:00
|
|
|
SetNewPkg( equivItem.m_FootprintFPID );
|
2011-06-10 14:33:52 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-04-23 15:02:18 +00:00
|
|
|
}
|
2013-04-25 16:29:35 +00:00
|
|
|
|
2015-01-13 08:05:43 +00:00
|
|
|
if( found )
|
|
|
|
continue;
|
|
|
|
|
2014-07-05 20:42:59 +00:00
|
|
|
// obviously the last chance: there's only one filter matching one footprint
|
2015-01-13 08:05:43 +00:00
|
|
|
if( 1 == component->GetFootprintFilters().GetCount() )
|
2013-04-25 16:29:35 +00:00
|
|
|
{
|
2015-09-21 20:39:59 +00:00
|
|
|
// we do not need to analyze wildcards: single footprint do not
|
2014-07-05 20:42:59 +00:00
|
|
|
// contain them and if there are wildcards it just will not match any
|
2017-03-23 00:59:25 +00:00
|
|
|
const FOOTPRINT_INFO* module = m_FootprintsList->GetModuleInfo( component->GetFootprintFilters()[0] );
|
2013-04-25 16:29:35 +00:00
|
|
|
|
|
|
|
if( module )
|
|
|
|
SetNewPkg( component->GetFootprintFilters()[0] );
|
2011-10-20 11:28:37 +00:00
|
|
|
}
|
2009-04-05 20:49:15 +00:00
|
|
|
}
|
2013-04-25 16:29:35 +00:00
|
|
|
|
2015-01-13 08:05:43 +00:00
|
|
|
if( !error_msg.IsEmpty() )
|
|
|
|
wxMessageBox( error_msg, _( "CvPcb Warning" ), wxOK | wxICON_WARNING, this );
|
|
|
|
|
2012-05-25 06:58:52 +00:00
|
|
|
m_skipComponentSelect = false;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|