From e784171e11472a96650eef89be8c97518961ffe9 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 30 Jan 2012 14:25:46 +0100 Subject: [PATCH] Pcbnew: Minor fix and enhancement. --- pcbnew/class_module.cpp | 3 +++ pcbnew/netlist.cpp | 52 ++++++++++++++++++++++++++++------------- 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 3db494eae7..53a17553bc 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -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; diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 05fda51748..da5fd8af11 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -65,6 +65,7 @@ #include #include #include +#include #include @@ -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("

") << _( "Duplicates:" ) << wxT("

"); + 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("") ); + list << wxT("
") << wxT("[noref)"); else - list.Add( module->m_Reference->m_Text ); + list << wxT("
") << module->m_Reference->m_Text; - nberr++; + list << wxT(" (") << module->m_Value->m_Text << wxT(")"); + err_cnt++; break; } } + if( ERR_CNT_MAX < err_cnt ) + break; } // Search for missing modules on board. - list.Add( _( "Missing:" ) ); + list << wxT("

") << _( "Missing:" ) << wxT("

"); 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("
") << mod_info->m_Reference; + list << wxT(" (") << mod_info->m_Value << wxT(")"); + 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("

") << _( "Not in Netlist:" ) << wxT("

"); 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("
") << wxT("[noref)"); + else + list << wxT("
") << module->m_Reference->m_Text ; + list << wxT(" (") << module->m_Value->m_Text << wxT(")"); + err_cnt++; } + if( ERR_CNT_MAX < err_cnt ) + break; + } + if( ERR_CNT_MAX < err_cnt ) + { + list << wxT("

") + << _( "Too many errors: some are skipped" ) + << wxT("

"); } - wxSingleChoiceDialog dlg( this, wxEmptyString, _( "Check Modules" ), list, NULL, - wxCHOICEDLG_STYLE & ~wxCANCEL ); - + HTML_MESSAGE_BOX dlg( this, _( "Check Modules" ) ); + dlg.AddHTML_Text(list); dlg.ShowModal(); }