Commit e6306723 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: Minor fix and enhancement.

parent ee8d721c
...@@ -85,7 +85,9 @@ MODULE::MODULE( const MODULE& aModule ) : ...@@ -85,7 +85,9 @@ MODULE::MODULE( const MODULE& aModule ) :
m_Pos = aModule.m_Pos; m_Pos = aModule.m_Pos;
m_LibRef = aModule.m_LibRef; m_LibRef = aModule.m_LibRef;
m_Layer = aModule.m_Layer;
m_Attributs = aModule.m_Attributs; m_Attributs = aModule.m_Attributs;
m_ModuleStatus = aModule.m_ModuleStatus;
m_Orient = aModule.m_Orient; m_Orient = aModule.m_Orient;
m_BoundaryBox = aModule.m_BoundaryBox; m_BoundaryBox = aModule.m_BoundaryBox;
m_PadNum = aModule.m_PadNum; m_PadNum = aModule.m_PadNum;
...@@ -199,6 +201,7 @@ void MODULE::Copy( MODULE* aModule ) ...@@ -199,6 +201,7 @@ void MODULE::Copy( MODULE* aModule )
m_Layer = aModule->m_Layer; m_Layer = aModule->m_Layer;
m_LibRef = aModule->m_LibRef; m_LibRef = aModule->m_LibRef;
m_Attributs = aModule->m_Attributs; m_Attributs = aModule->m_Attributs;
m_ModuleStatus = aModule->m_ModuleStatus;
m_Orient = aModule->m_Orient; m_Orient = aModule->m_Orient;
m_BoundaryBox = aModule->m_BoundaryBox; m_BoundaryBox = aModule->m_BoundaryBox;
m_PadNum = aModule->m_PadNum; m_PadNum = aModule->m_PadNum;
......
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
#include <class_module.h> #include <class_module.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <dialog_netlist.h> #include <dialog_netlist.h>
#include <html_messagebox.h>
#include <netlist_reader.h> #include <netlist_reader.h>
...@@ -528,8 +529,9 @@ MODULE* PCB_EDIT_FRAME::ListAndSelectModuleName( void ) ...@@ -528,8 +529,9 @@ MODULE* PCB_EDIT_FRAME::ListAndSelectModuleName( void )
void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints( void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints(
const wxString& aNetlistFullFilename ) const wxString& aNetlistFullFilename )
{ {
int nberr = 0; #define ERR_CNT_MAX 100 // Max number of errors to output in dialog
wxArrayString list; // The list of messages to display // to avoid a too long calculation time
wxString list; // The messages to display
if( GetBoard()->m_Modules == NULL ) if( GetBoard()->m_Modules == NULL )
{ {
...@@ -542,6 +544,7 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints( ...@@ -542,6 +544,7 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints(
return; return;
SetLastNetListRead( aNetlistFullFilename ); SetLastNetListRead( aNetlistFullFilename );
// Build the list of references of the net list modules. // Build the list of references of the net list modules.
NETLIST_READER netList_Reader( this ); NETLIST_READER netList_Reader( this );
netList_Reader.SetFilesnames( aNetlistFullFilename, wxEmptyString ); netList_Reader.SetFilesnames( aNetlistFullFilename, wxEmptyString );
...@@ -558,10 +561,10 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints( ...@@ -558,10 +561,10 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints(
} }
// Search for duplicate 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; MODULE* module = GetBoard()->m_Modules;
for( ; module != NULL; module = module->Next() ) for( ; module != NULL; module = module->Next() )
{ {
MODULE* altmodule = module->Next(); MODULE* altmodule = module->Next();
...@@ -571,18 +574,21 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints( ...@@ -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.CmpNoCase( altmodule->m_Reference->m_Text ) == 0 )
{ {
if( module->m_Reference->m_Text.IsEmpty() ) if( module->m_Reference->m_Text.IsEmpty() )
list.Add( wxT("<noref>") ); list << wxT("<br>") << wxT("[noref)");
else 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; break;
} }
} }
if( ERR_CNT_MAX < err_cnt )
break;
} }
// Search for missing modules on board. // 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++ ) for( unsigned ii = 0; ii < moduleInfoList.size(); ii++ )
{ {
...@@ -590,13 +596,16 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints( ...@@ -590,13 +596,16 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints(
module = GetBoard()->FindModuleByReference( mod_info->m_Reference ); module = GetBoard()->FindModuleByReference( mod_info->m_Reference );
if( module == NULL ) // Module missing, not found in board if( module == NULL ) // Module missing, not found in board
{ {
list.Add( mod_info->m_Reference ); list << wxT("<br>") << mod_info->m_Reference;
nberr++; 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. // 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; module = GetBoard()->m_Modules;
for( ; module != NULL; module = module->Next() ) for( ; module != NULL; module = module->Next() )
...@@ -611,14 +620,25 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints( ...@@ -611,14 +620,25 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints(
if( ii == moduleInfoList.size() ) // Module not found in netlist if( ii == moduleInfoList.size() ) // Module not found in netlist
{ {
list.Add( module->m_Reference->m_Text ); if( module->m_Reference->m_Text.IsEmpty() )
nberr++; 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, HTML_MESSAGE_BOX dlg( this, _( "Check Modules" ) );
wxCHOICEDLG_STYLE & ~wxCANCEL ); dlg.AddHTML_Text(list);
dlg.ShowModal(); dlg.ShowModal();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment