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

Pcbnew: fix minor bugs. Fix bug 1091593 and 1091693 . Minor code cleaning

parent 63b88455
......@@ -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
*/
void Test_Duplicate_Missing_And_Extra_Footprints( const wxString& aNetlistFullFilename );
* @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
*/
bool Test_Duplicate_Missing_And_Extra_Footprints( const wxString& aFilename,
std::vector <MODULE*>& aDuplicate,
wxArrayString& aMissing,
std::vector <MODULE*>& aNotInNetlist );
/**
* Function OnHotKey.
......
......@@ -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
......
......@@ -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;
}
......
/////////////////////////////////////////////////////////////////////////////
// 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 <fctsys.h>
#include <appl_wxstruct.h>
#include <confirm.h>
#include <pcbnew.h>
#include <dialog_helpers.h>
#include <html_messagebox.h>
#include <base_units.h>
#include <wxPcbStruct.h>
#include <macros.h>
#include <pcbcommon.h>
#include <pcbnew_config.h>
#include <class_board_design_settings.h>
#include <class_board.h>
#include <class_module.h>
#include <wildcards_and_files_ext.h>
#include <dialog_netlist.h>
......@@ -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 <MODULE*> duplicate;
wxArrayString missing;
std::vector <MODULE*> 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("<p><b>") << _( "No duplicate." ) << wxT("</b></p>");
else
{
list << wxT("<p><b>") << _( "Duplicates:" ) << wxT("</b></p>");
for( unsigned ii = 0; ii < duplicate.size(); ii++ )
{
MODULE* module = duplicate[ii];
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>)");
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("<p><b>") << _( "No missing modules." ) << wxT("</b></p>");
else
{
list << wxT("<p><b>") << _( "Missing:" ) << wxT("</b></p>");
for( unsigned ii = 0; ii < missing.size(); ii += 2 )
{
list << wxT("<br>") << missing[ii];
list << wxT(" (<i>") << missing[ii+1] << wxT("</i>)");
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("<p><b>") << _( "No extra modules." ) << wxT("</b></p>");
else
{
list << wxT("<p><b>") << _( "Not in Netlist:" ) << wxT("</b></p>");
for( unsigned ii = 0; ii < notInNetlist.size(); ii++ )
{
MODULE* module = notInNetlist[ii];
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>)");
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("<p><b>")
<< _( "Too many errors: some are skipped" )
<< wxT("</b></p>");
}
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 );
}
......
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_netlist.h
/// Author: jean-pierre Charras
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 26/02/2006 17:42:19
/**
* @file dialog_netlist.h
*/
/*
* 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;
public:
DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC,
const wxString & aNetlistFull_Filename );
~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:
PCB_EDIT_FRAME * m_parent;
wxDC * m_dc;
public:
DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC,
const wxString & aNetlistFullFilename );
~DIALOG_NETLIST() {};
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 );
};
......
......@@ -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 );
}
......@@ -493,7 +493,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
......@@ -532,7 +532,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button1</property>
<property name="name">m_buttonBrowse</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -553,7 +553,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnOpenNelistClick</event>
<event name="OnButtonClick">OnOpenNetlistClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
......@@ -581,7 +581,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
......@@ -620,7 +620,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button2</property>
<property name="name">m_buttonRead</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -669,7 +669,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
......@@ -708,7 +708,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button3</property>
<property name="name">m_buttonFPTest</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -757,7 +757,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
......@@ -796,7 +796,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button4</property>
<property name="name">m_buttonRebild</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -884,7 +884,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_button5</property>
<property name="name">m_buttonClose</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......
......@@ -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(); }
......
......@@ -65,7 +65,6 @@
#include <class_module.h>
#include <pcbnew.h>
#include <dialog_netlist.h>
#include <html_messagebox.h>
#include <netlist_reader.h>
......@@ -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 <MODULE*>& aDuplicate,
wxArrayString& aMissing,
std::vector <MODULE*>& 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("<p><b>") << _( "Duplicates:" ) << wxT("</b></p>");
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("<br>") << wxT("[noref)");
else
list << wxT("<br>") << module->m_Reference->m_Text;
list << wxT(" (<i>") << module->m_Value->m_Text << wxT("</i>)");
err_cnt++;
aDuplicate.push_back( module );
break;
}
}
if( ERR_CNT_MAX < err_cnt )
break;
}
// Search for missing modules on board.
list << wxT("<p><b>") << _( "Missing:" ) << wxT("</b></p>");
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("<br>") << cmp_info->m_Reference;
list << wxT(" (<i>") << cmp_info->m_Value << wxT("</i>)");
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("<p><b>") << _( "Not in Netlist:" ) << wxT("</b></p>");
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("<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>");
aNotInNetlist.push_back( module );
}
HTML_MESSAGE_BOX dlg( this, _( "Check Modules" ) );
dlg.AddHTML_Text(list);
dlg.ShowModal();
return true;
}
......@@ -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;
}
......
......@@ -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() )
......
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