From ea603c4deb2e856afafbeffa0f09add9b1efc1d0 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 18 Dec 2012 18:50:00 +0100 Subject: [PATCH] Pcbnew: fix minor bugs. Fix bug 1091593 and 1091693 . Minor code cleaning --- include/wxPcbStruct.h | 13 +- pcbnew/dialogs/dialog_cleaning_options.cpp | 2 +- pcbnew/dialogs/dialog_copper_zones.cpp | 2 +- pcbnew/dialogs/dialog_netlist.cpp | 164 ++++++++++++++++-- pcbnew/dialogs/dialog_netlist.h | 60 ++++--- pcbnew/dialogs/dialog_netlist_fbp.cpp | 48 ++--- pcbnew/dialogs/dialog_netlist_fbp.fbp | 20 +-- pcbnew/dialogs/dialog_netlist_fbp.h | 12 +- pcbnew/netlist.cpp | 86 +++------ pcbnew/pcb_parser.cpp | 1 + ...nvert_brd_items_to_polygons_with_Boost.cpp | 5 +- 11 files changed, 265 insertions(+), 148 deletions(-) diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 1c99f9210f..06f124cb7c 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -404,9 +404,18 @@ public: * 1 - duplicate footprints on board * 2 - missing footprints (found in netlist but not on board) * 3 - footprints not in netlist but on board - * @param aNetlistFullFilename = the full filename netlist + * @param aFilename = the full filename netlist + * @param aDuplicate = the list of duplicate modules to populate + * @param aMissing = the list of missing module references and values + * to populate. For each missing item, the first string is the ref, + * the second is the value. + * @param aNotInNetlist = the list of not-in-netlist modules to populate + * @return true if the netlist was read, or false */ - void Test_Duplicate_Missing_And_Extra_Footprints( const wxString& aNetlistFullFilename ); + bool Test_Duplicate_Missing_And_Extra_Footprints( const wxString& aFilename, + std::vector & aDuplicate, + wxArrayString& aMissing, + std::vector & aNotInNetlist ); /** * Function OnHotKey. diff --git a/pcbnew/dialogs/dialog_cleaning_options.cpp b/pcbnew/dialogs/dialog_cleaning_options.cpp index eebd22076d..1ad475b323 100644 --- a/pcbnew/dialogs/dialog_cleaning_options.cpp +++ b/pcbnew/dialogs/dialog_cleaning_options.cpp @@ -5,7 +5,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-20112 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index 9cbab3b58c..06483cfcd6 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -448,7 +448,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab if( m_settings.m_ThermalReliefCopperBridge <= m_settings.m_ZoneMinThickness ) { DisplayError( this, - _( "Thermal relief spoke width is larger than the minimum width." ) ); + _( "Thermal relief spoke width is smaller than the minimum width." ) ); return false; } diff --git a/pcbnew/dialogs/dialog_netlist.cpp b/pcbnew/dialogs/dialog_netlist.cpp index 64e9b38703..292ff6eb90 100644 --- a/pcbnew/dialogs/dialog_netlist.cpp +++ b/pcbnew/dialogs/dialog_netlist.cpp @@ -1,20 +1,43 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dialog_netlist.cpp -// Author: jean-pierre Charras -// Licence: GPL -///////////////////////////////////////////////////////////////////////////// +/** + * @file dialog_netlist.cpp + */ + +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors. + * + * 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 + */ #include #include #include -#include +#include +#include +#include #include -#include #include #include #include #include +#include #include #include @@ -53,12 +76,12 @@ void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC ) DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC, - const wxString & aNetlistFull_Filename ) + const wxString & aNetlistFullFilename ) : DIALOG_NETLIST_FBP( aParent ) { - m_Parent = aParent; - m_DC = aDC; - m_NetlistFilenameCtrl->SetValue( aNetlistFull_Filename ); + m_parent = aParent; + m_dc = aDC; + m_NetlistFilenameCtrl->SetValue( aNetlistFullFilename ); Init(); @@ -71,10 +94,10 @@ void DIALOG_NETLIST::Init() SetFocus(); } -void DIALOG_NETLIST::OnOpenNelistClick( wxCommandEvent& event ) +void DIALOG_NETLIST::OnOpenNetlistClick( wxCommandEvent& event ) { wxString lastPath = wxFileName::GetCwd(); - wxString lastNetlistRead = m_Parent->GetLastNetListRead(); + wxString lastNetlistRead = m_parent->GetLastNetListRead(); if( !lastNetlistRead.IsEmpty() && !wxFileName::FileExists( lastNetlistRead ) ) { @@ -105,7 +128,7 @@ void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event ) wxFileName fn = m_NetlistFilenameCtrl->GetValue(); fn.SetExt( ComponentFileExtension ); - m_Parent->ReadPcbNetlist( m_NetlistFilenameCtrl->GetValue(), + m_parent->ReadPcbNetlist( m_NetlistFilenameCtrl->GetValue(), fn.GetFullPath(), m_MessageWindow, m_ChangeExistingFootprintCtrl->GetSelection() == 1 ? true : false, m_DeleteBadTracks->GetSelection() == 1 ? true : false, @@ -116,7 +139,116 @@ void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event ) void DIALOG_NETLIST::OnTestFootprintsClick( wxCommandEvent& event ) { - m_Parent->Test_Duplicate_Missing_And_Extra_Footprints( m_NetlistFilenameCtrl->GetValue() ); + if( m_parent->GetBoard()->m_Modules == NULL ) + { + DisplayInfoMessage( this, _( "No modules" ) ); + return; + } + + // Lists of duplicates, missing references and not in netlist footprints: + std::vector duplicate; + wxArrayString missing; + std::vector notInNetlist; + wxString netlistFilename = m_NetlistFilenameCtrl->GetValue(); + + if( ! m_parent->Test_Duplicate_Missing_And_Extra_Footprints( + netlistFilename, duplicate, missing, notInNetlist ) ) + { + wxMessageBox( _("Netlist file not found!") ); + return; + } + + #define ERR_CNT_MAX 100 // Max number of errors to output in dialog + // to avoid a too long message list + + wxString list; // The messages to display + + m_parent->SetLastNetListRead( netlistFilename ); + + int err_cnt = 0; + + // Search for duplicate footprints. + if( duplicate.size() == 0 ) + list << wxT("

") << _( "No duplicate." ) << wxT("

"); + else + { + list << wxT("

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

"); + + for( unsigned ii = 0; ii < duplicate.size(); ii++ ) + { + MODULE* module = duplicate[ii]; + + 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(")"); + list << wxT(" @ "); + list << CoordinateToString( module->GetPosition().x ), + list << wxT(", ") << CoordinateToString( module->GetPosition().y ), + err_cnt++; + + if( ERR_CNT_MAX < err_cnt ) + break; + } + } + + // Search for missing modules on board. + if( missing.size() == 0 ) + list << wxT("

") << _( "No missing modules." ) << wxT("

"); + else + { + list << wxT("

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

"); + + for( unsigned ii = 0; ii < missing.size(); ii += 2 ) + { + list << wxT("
") << missing[ii]; + list << wxT(" (") << missing[ii+1] << wxT(")"); + err_cnt++; + + if( ERR_CNT_MAX < err_cnt ) + break; + } + } + + + // Search for modules found on board but not in net list. + if( notInNetlist.size() == 0 ) + list << wxT("

") << _( "No extra modules." ) << wxT("

"); + else + { + list << wxT("

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

"); + + for( unsigned ii = 0; ii < notInNetlist.size(); ii++ ) + { + MODULE* module = notInNetlist[ii]; + + 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(")"); + list << wxT(" @ "); + list << CoordinateToString( module->GetPosition().x ), + list << wxT(", ") << CoordinateToString( module->GetPosition().y ), + err_cnt++; + + if( ERR_CNT_MAX < err_cnt ) + break; + } + } + + if( ERR_CNT_MAX < err_cnt ) + { + list << wxT("

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

"); + } + + HTML_MESSAGE_BOX dlg( this, _( "Check Modules" ) ); + dlg.AddHTML_Text(list); + dlg.ShowModal(); } @@ -126,7 +258,7 @@ void DIALOG_NETLIST::OnTestFootprintsClick( wxCommandEvent& event ) void DIALOG_NETLIST::OnCompileRatsnestClick( wxCommandEvent& event ) { - m_Parent->Compile_Ratsnest( m_DC, true ); + m_parent->Compile_Ratsnest( m_dc, true ); } diff --git a/pcbnew/dialogs/dialog_netlist.h b/pcbnew/dialogs/dialog_netlist.h index d227c32a7a..d022bbe8b1 100644 --- a/pcbnew/dialogs/dialog_netlist.h +++ b/pcbnew/dialogs/dialog_netlist.h @@ -1,10 +1,29 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dialog_netlist.h -/// Author: jean-pierre Charras -// Licence: GPL -///////////////////////////////////////////////////////////////////////////// +/** + * @file dialog_netlist.h + */ -// Generated by DialogBlocks (unregistered), 26/02/2006 17:42:19 +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors. + * + * 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 + */ #ifndef _DIALOG_NETLIST_H_ #define _DIALOG_NETLIST_H_ @@ -14,23 +33,24 @@ class DIALOG_NETLIST : public DIALOG_NETLIST_FBP { - private: - PCB_EDIT_FRAME * m_Parent; - wxDC * m_DC; +private: + PCB_EDIT_FRAME * m_parent; + wxDC * m_dc; - public: - DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC, - const wxString & aNetlistFull_Filename ); - ~DIALOG_NETLIST() {}; +public: + DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC, + const wxString & aNetlistFullFilename ); + ~DIALOG_NETLIST() {}; - void Init(); - // Virtual event handlers, overide them in your derived class - void OnOpenNelistClick( wxCommandEvent& event ); - void OnReadNetlistFileClick( wxCommandEvent& event ); - void OnTestFootprintsClick( wxCommandEvent& event ); - void OnCompileRatsnestClick( wxCommandEvent& event ); - void OnCancelClick( wxCommandEvent& event ); +private: + void Init(); + // Virtual event handlers, overide them in your derived class + void OnOpenNetlistClick( wxCommandEvent& event ); + void OnReadNetlistFileClick( wxCommandEvent& event ); + void OnTestFootprintsClick( wxCommandEvent& event ); + void OnCompileRatsnestClick( wxCommandEvent& event ); + void OnCancelClick( wxCommandEvent& event ); }; diff --git a/pcbnew/dialogs/dialog_netlist_fbp.cpp b/pcbnew/dialogs/dialog_netlist_fbp.cpp index e01a568c64..dba5ef519e 100644 --- a/pcbnew/dialogs/dialog_netlist_fbp.cpp +++ b/pcbnew/dialogs/dialog_netlist_fbp.cpp @@ -66,27 +66,27 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w wxBoxSizer* bRightSizerButtons; bRightSizerButtons = new wxBoxSizer( wxVERTICAL ); - m_button1 = new wxButton( this, ID_OPEN_NELIST, _("Browse Netlist Files"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightSizerButtons->Add( m_button1, 0, wxALL|wxEXPAND, 5 ); + m_buttonBrowse = new wxButton( this, ID_OPEN_NELIST, _("Browse Netlist Files"), wxDefaultPosition, wxDefaultSize, 0 ); + bRightSizerButtons->Add( m_buttonBrowse, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - m_button2 = new wxButton( this, ID_READ_NETLIST_FILE, _("Read Current Netlist"), wxDefaultPosition, wxDefaultSize, 0 ); - m_button2->SetDefault(); - m_button2->SetToolTip( _("Read the current netlist and update connections and connectivity info") ); + m_buttonRead = new wxButton( this, ID_READ_NETLIST_FILE, _("Read Current Netlist"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonRead->SetDefault(); + m_buttonRead->SetToolTip( _("Read the current netlist and update connections and connectivity info") ); - bRightSizerButtons->Add( m_button2, 0, wxALL|wxEXPAND, 5 ); + bRightSizerButtons->Add( m_buttonRead, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - m_button3 = new wxButton( this, ID_TEST_NETLIST, _("Footprints Test"), wxDefaultPosition, wxDefaultSize, 0 ); - m_button3->SetToolTip( _("Read the current neltist file and list missing and extra footprints") ); + m_buttonFPTest = new wxButton( this, ID_TEST_NETLIST, _("Footprints Test"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonFPTest->SetToolTip( _("Read the current neltist file and list missing and extra footprints") ); - bRightSizerButtons->Add( m_button3, 0, wxALL|wxEXPAND, 5 ); + bRightSizerButtons->Add( m_buttonFPTest, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - m_button4 = new wxButton( this, ID_COMPILE_RATSNEST, _("Rebuild Board Connectivity"), wxDefaultPosition, wxDefaultSize, 0 ); - m_button4->SetToolTip( _("Rebuild the full ratsnest (usefull after a manual pad netname edition)") ); + m_buttonRebild = new wxButton( this, ID_COMPILE_RATSNEST, _("Rebuild Board Connectivity"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonRebild->SetToolTip( _("Rebuild the full ratsnest (usefull after a manual pad netname edition)") ); - bRightSizerButtons->Add( m_button4, 0, wxALL|wxEXPAND, 5 ); + bRightSizerButtons->Add( m_buttonRebild, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - m_button5 = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightSizerButtons->Add( m_button5, 0, wxALL|wxEXPAND, 5 ); + m_buttonClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); + bRightSizerButtons->Add( m_buttonClose, 0, wxALL|wxEXPAND, 5 ); bUpperSizer->Add( bRightSizerButtons, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -118,20 +118,20 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w this->Layout(); // Connect Events - m_button1->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnOpenNelistClick ), NULL, this ); - m_button2->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnReadNetlistFileClick ), NULL, this ); - m_button3->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnTestFootprintsClick ), NULL, this ); - m_button4->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnCompileRatsnestClick ), NULL, this ); - m_button5->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnCancelClick ), NULL, this ); + m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnOpenNetlistClick ), NULL, this ); + m_buttonRead->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnReadNetlistFileClick ), NULL, this ); + m_buttonFPTest->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnTestFootprintsClick ), NULL, this ); + m_buttonRebild->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnCompileRatsnestClick ), NULL, this ); + m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnCancelClick ), NULL, this ); } DIALOG_NETLIST_FBP::~DIALOG_NETLIST_FBP() { // Disconnect Events - m_button1->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnOpenNelistClick ), NULL, this ); - m_button2->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnReadNetlistFileClick ), NULL, this ); - m_button3->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnTestFootprintsClick ), NULL, this ); - m_button4->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnCompileRatsnestClick ), NULL, this ); - m_button5->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnCancelClick ), NULL, this ); + m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnOpenNetlistClick ), NULL, this ); + m_buttonRead->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnReadNetlistFileClick ), NULL, this ); + m_buttonFPTest->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnTestFootprintsClick ), NULL, this ); + m_buttonRebild->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnCompileRatsnestClick ), NULL, this ); + m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnCancelClick ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_netlist_fbp.fbp b/pcbnew/dialogs/dialog_netlist_fbp.fbp index e91deea091..1259ecf113 100644 --- a/pcbnew/dialogs/dialog_netlist_fbp.fbp +++ b/pcbnew/dialogs/dialog_netlist_fbp.fbp @@ -493,7 +493,7 @@ none 5 - wxALL|wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -532,7 +532,7 @@ 0 1 - m_button1 + m_buttonBrowse 1 @@ -553,7 +553,7 @@ - OnOpenNelistClick + OnOpenNetlistClick @@ -581,7 +581,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -620,7 +620,7 @@ 0 1 - m_button2 + m_buttonRead 1 @@ -669,7 +669,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -708,7 +708,7 @@ 0 1 - m_button3 + m_buttonFPTest 1 @@ -757,7 +757,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -796,7 +796,7 @@ 0 1 - m_button4 + m_buttonRebild 1 @@ -884,7 +884,7 @@ 0 1 - m_button5 + m_buttonClose 1 diff --git a/pcbnew/dialogs/dialog_netlist_fbp.h b/pcbnew/dialogs/dialog_netlist_fbp.h index 19762bb790..90347118a4 100644 --- a/pcbnew/dialogs/dialog_netlist_fbp.h +++ b/pcbnew/dialogs/dialog_netlist_fbp.h @@ -47,11 +47,11 @@ class DIALOG_NETLIST_FBP : public DIALOG_SHIM wxRadioBox* m_ChangeExistingFootprintCtrl; wxRadioBox* m_DeleteBadTracks; wxRadioBox* m_RemoveExtraFootprintsCtrl; - wxButton* m_button1; - wxButton* m_button2; - wxButton* m_button3; - wxButton* m_button4; - wxButton* m_button5; + wxButton* m_buttonBrowse; + wxButton* m_buttonRead; + wxButton* m_buttonFPTest; + wxButton* m_buttonRebild; + wxButton* m_buttonClose; wxStaticLine* m_staticline1; wxStaticText* m_staticTextNetfilename; wxTextCtrl* m_NetlistFilenameCtrl; @@ -59,7 +59,7 @@ class DIALOG_NETLIST_FBP : public DIALOG_SHIM wxTextCtrl* m_MessageWindow; // Virtual event handlers, overide them in your derived class - virtual void OnOpenNelistClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOpenNetlistClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnReadNetlistFileClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnTestFootprintsClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnCompileRatsnestClick( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index a38a04bf7e..b38a10300d 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -65,7 +65,6 @@ #include #include #include -#include #include @@ -251,46 +250,33 @@ MODULE* PCB_EDIT_FRAME::ListAndSelectModuleName( void ) * 1 - duplicate footprints on board * 2 - missing footprints (found in netlist but not on board) * 3 - footprints not in netlist but on board - * @param aNetlistFullFilename = the full filename netlist + * param aFilename = the full filename netlist + * param aDuplicate = the list of duplicate modules to populate + * param aMissing = the list of missing module references and values + * to populate. For each missing item, the first string is the ref, + * the second is the value. + * param aNotInNetlist = the list of not-in-netlist modules to populate */ -void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints( - const wxString& aNetlistFullFilename ) +bool PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints( + const wxString& aFilename, + std::vector & aDuplicate, + wxArrayString& aMissing, + std::vector & aNotInNetlist ) { - #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 ) - { - DisplayInfoMessage( this, _( "No modules" ) ); - return; - } - - FILE* netfile = OpenNetlistFile( aNetlistFullFilename ); + FILE* netfile = OpenNetlistFile( aFilename ); if( !netfile ) - return; - - SetLastNetListRead( aNetlistFullFilename ); + return false; // Build the list of references of the net list modules. NETLIST_READER netList_Reader( this ); - netList_Reader.SetFilesnames( aNetlistFullFilename, wxEmptyString ); + netList_Reader.SetFilesnames( aFilename, wxEmptyString ); netList_Reader.BuildModuleListOnlySetOpt( true ); if( ! netList_Reader.ReadNetList( netfile ) ) - return; // error + return false; // error COMPONENT_INFO_LIST& moduleInfoList = netList_Reader.GetComponentInfoList(); - if( moduleInfoList.size() == 0 ) - { - wxMessageBox( _( "No modules in NetList" ) ); - return; - } - // Search for duplicate footprints. - list << wxT("

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

"); - - int err_cnt = 0; MODULE* module = GetBoard()->m_Modules; for( ; module != NULL; module = module->Next() ) { @@ -300,40 +286,25 @@ 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 << wxT("
") << wxT("[noref)"); - else - list << wxT("
") << module->m_Reference->m_Text; - - list << wxT(" (") << module->m_Value->m_Text << wxT(")"); - err_cnt++; + aDuplicate.push_back( module ); break; } } - if( ERR_CNT_MAX < err_cnt ) - break; } // Search for missing modules on board. - list << wxT("

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

"); - for( unsigned ii = 0; ii < moduleInfoList.size(); ii++ ) { COMPONENT_INFO* cmp_info = moduleInfoList[ii]; module = GetBoard()->FindModuleByReference( cmp_info->m_Reference ); if( module == NULL ) // Module missing, not found in board { - list << wxT("
") << cmp_info->m_Reference; - list << wxT(" (") << cmp_info->m_Value << wxT(")"); - err_cnt++; + aMissing.Add( cmp_info->m_Reference ); + aMissing.Add( cmp_info->m_Value ); } - if( ERR_CNT_MAX < err_cnt ) - break; } // Search for modules found on board but not in net list. - list << wxT("

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

"); - module = GetBoard()->m_Modules; for( ; module != NULL; module = module->Next() ) { @@ -346,25 +317,8 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints( } if( ii == moduleInfoList.size() ) // Module not found in netlist - { - 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("

"); + aNotInNetlist.push_back( module ); } - HTML_MESSAGE_BOX dlg( this, _( "Check Modules" ) ); - dlg.AddHTML_Text(list); - dlg.ShowModal(); + return true; } diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index f41cfe99a4..0c27628d13 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -1406,6 +1406,7 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR ) { TEXTE_PCB* text = parseTEXTE_PCB(); dimension->m_Text = *text; + dimension->SetPosition( text->GetPosition() ); delete text; break; } diff --git a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp index ef7026611a..d6a6367b73 100644 --- a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp +++ b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp @@ -443,8 +443,9 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) cornerBufferPolysToSubstract.clear(); // Test thermal stubs connections and add polygons to remove unconnected stubs. - BuildUnconnectedThermalStubsPolygonList( cornerBufferPolysToSubstract, aPcb, this, - s_Correction, s_thermalRot ); + if( GetNet() > 0 ) + BuildUnconnectedThermalStubsPolygonList( cornerBufferPolysToSubstract, aPcb, this, + s_Correction, s_thermalRot ); // remove copper areas if( cornerBufferPolysToSubstract.size() )