Pcbnew: Minor fix and enhancement.
This commit is contained in:
parent
ee8d721c3c
commit
e630672397
|
@ -85,7 +85,9 @@ MODULE::MODULE( const MODULE& aModule ) :
|
|||
|
||||
m_Pos = aModule.m_Pos;
|
||||
m_LibRef = aModule.m_LibRef;
|
||||
m_Layer = aModule.m_Layer;
|
||||
m_Attributs = aModule.m_Attributs;
|
||||
m_ModuleStatus = aModule.m_ModuleStatus;
|
||||
m_Orient = aModule.m_Orient;
|
||||
m_BoundaryBox = aModule.m_BoundaryBox;
|
||||
m_PadNum = aModule.m_PadNum;
|
||||
|
@ -199,6 +201,7 @@ void MODULE::Copy( MODULE* aModule )
|
|||
m_Layer = aModule->m_Layer;
|
||||
m_LibRef = aModule->m_LibRef;
|
||||
m_Attributs = aModule->m_Attributs;
|
||||
m_ModuleStatus = aModule->m_ModuleStatus;
|
||||
m_Orient = aModule->m_Orient;
|
||||
m_BoundaryBox = aModule->m_BoundaryBox;
|
||||
m_PadNum = aModule->m_PadNum;
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include <class_module.h>
|
||||
#include <pcbnew.h>
|
||||
#include <dialog_netlist.h>
|
||||
#include <html_messagebox.h>
|
||||
|
||||
#include <netlist_reader.h>
|
||||
|
||||
|
@ -528,8 +529,9 @@ MODULE* PCB_EDIT_FRAME::ListAndSelectModuleName( void )
|
|||
void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints(
|
||||
const wxString& aNetlistFullFilename )
|
||||
{
|
||||
int nberr = 0;
|
||||
wxArrayString list; // The list of messages to display
|
||||
#define ERR_CNT_MAX 100 // Max number of errors to output in dialog
|
||||
// to avoid a too long calculation time
|
||||
wxString list; // The messages to display
|
||||
|
||||
if( GetBoard()->m_Modules == NULL )
|
||||
{
|
||||
|
@ -542,6 +544,7 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints(
|
|||
return;
|
||||
|
||||
SetLastNetListRead( aNetlistFullFilename );
|
||||
|
||||
// Build the list of references of the net list modules.
|
||||
NETLIST_READER netList_Reader( this );
|
||||
netList_Reader.SetFilesnames( aNetlistFullFilename, wxEmptyString );
|
||||
|
@ -558,10 +561,10 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints(
|
|||
}
|
||||
|
||||
// Search for duplicate footprints.
|
||||
list.Add( _( "Duplicates" ) );
|
||||
list << wxT("<p><b>") << _( "Duplicates:" ) << wxT("</b></p>");
|
||||
|
||||
int err_cnt = 0;
|
||||
MODULE* module = GetBoard()->m_Modules;
|
||||
|
||||
for( ; module != NULL; module = module->Next() )
|
||||
{
|
||||
MODULE* altmodule = module->Next();
|
||||
|
@ -571,18 +574,21 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints(
|
|||
if( module->m_Reference->m_Text.CmpNoCase( altmodule->m_Reference->m_Text ) == 0 )
|
||||
{
|
||||
if( module->m_Reference->m_Text.IsEmpty() )
|
||||
list.Add( wxT("<noref>") );
|
||||
list << wxT("<br>") << wxT("[noref)");
|
||||
else
|
||||
list.Add( module->m_Reference->m_Text );
|
||||
list << wxT("<br>") << module->m_Reference->m_Text;
|
||||
|
||||
nberr++;
|
||||
list << wxT(" (<i>") << module->m_Value->m_Text << wxT("</i>)");
|
||||
err_cnt++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( ERR_CNT_MAX < err_cnt )
|
||||
break;
|
||||
}
|
||||
|
||||
// Search for missing modules on board.
|
||||
list.Add( _( "Missing:" ) );
|
||||
list << wxT("<p><b>") << _( "Missing:" ) << wxT("</b></p>");
|
||||
|
||||
for( unsigned ii = 0; ii < moduleInfoList.size(); ii++ )
|
||||
{
|
||||
|
@ -590,13 +596,16 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints(
|
|||
module = GetBoard()->FindModuleByReference( mod_info->m_Reference );
|
||||
if( module == NULL ) // Module missing, not found in board
|
||||
{
|
||||
list.Add( mod_info->m_Reference );
|
||||
nberr++;
|
||||
list << wxT("<br>") << mod_info->m_Reference;
|
||||
list << wxT(" (<i>") << mod_info->m_Value << wxT("</i>)");
|
||||
err_cnt++;
|
||||
}
|
||||
if( ERR_CNT_MAX < err_cnt )
|
||||
break;
|
||||
}
|
||||
|
||||
// Search for modules found on board but not in net list.
|
||||
list.Add( _( "Not in Netlist:" ) );
|
||||
list << wxT("<p><b>") << _( "Not in Netlist:" ) << wxT("</b></p>");
|
||||
|
||||
module = GetBoard()->m_Modules;
|
||||
for( ; module != NULL; module = module->Next() )
|
||||
|
@ -611,14 +620,25 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints(
|
|||
|
||||
if( ii == moduleInfoList.size() ) // Module not found in netlist
|
||||
{
|
||||
list.Add( module->m_Reference->m_Text );
|
||||
nberr++;
|
||||
if( module->m_Reference->m_Text.IsEmpty() )
|
||||
list << wxT("<br>") << wxT("[noref)");
|
||||
else
|
||||
list << wxT("<br>") << module->m_Reference->m_Text ;
|
||||
list << wxT(" (<i>") << module->m_Value->m_Text << wxT("</i>)");
|
||||
err_cnt++;
|
||||
}
|
||||
if( ERR_CNT_MAX < err_cnt )
|
||||
break;
|
||||
}
|
||||
if( ERR_CNT_MAX < err_cnt )
|
||||
{
|
||||
list << wxT("<p><b>")
|
||||
<< _( "Too many errors: some are skipped" )
|
||||
<< wxT("</b></p>");
|
||||
}
|
||||
|
||||
wxSingleChoiceDialog dlg( this, wxEmptyString, _( "Check Modules" ), list, NULL,
|
||||
wxCHOICEDLG_STYLE & ~wxCANCEL );
|
||||
|
||||
HTML_MESSAGE_BOX dlg( this, _( "Check Modules" ) );
|
||||
dlg.AddHTML_Text(list);
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue