Commit 4428d69a authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: Fix a bug when reading a netlist which forces pcbnew to read lib files...

Pcbnew: Fix a bug when reading a netlist which forces pcbnew to read lib files to find a footprint even if the right footprint is already loaded (which explains the long time to load netlists)
Netlist dialog: add option to report only most important messages. Useful for large boards.
class REPORTER: add features to allow a basic message filtering (flags to report all/warning/error messages)
Fix Bug #1214599 ( tools are deselected on Move command )
parent 0be39929
......@@ -28,7 +28,6 @@
#include <macros.h>
#include <reporter.h>
REPORTER& REPORTER::Report( const char* aText )
{
Report( FROM_UTF8( aText ) );
......
EESchema-LIBRARY Version 2.3 Date: 07/08/2013 15:43:07
EESchema-LIBRARY Version 2.3
#encoding utf-8
#
# 4003APG120
......
Cmp-Mod V01 Created by CvPCB (2011-03-30 BZR 2935)-testing date = 02/04/2011 13:22:13
Cmp-Mod V01 Created by CvPcb (2013-08-20 BZR 4294)-product date = 21/08/2013 18:12:43
BeginCmp
TimeStamp = /322D3011;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -27,7 +27,7 @@ Comment3 "Comment 3"
Comment4 "Comment 4"
$EndDescr
$Bitmap
Pos 9250 10500
Pos 9350 10600
Scale 1,000000
Data
89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52 00 00 00 E5 00 00 01 0E 08 02 00 00 00 F9 5F 47
......@@ -1181,7 +1181,7 @@ BF FD 96 77 9E 38 7E F1 EC E1 55 E2 AF 2F E0 1B 5F F9 FC FE BD 4F B9 56 EB C9 C9
29 65 D5 9A 89 35 EB 37 F6 E3 02 4F 95 57 89 BF 1E 63 D9 CA D5 CB 7E 65 BC F3 FF E1 D5 7A 1F CE
A2 94 8E 79 E6 79 49 E6 FD 75 9E B9 C4 BC BF CE 33 97 98 F7 D7 79 E6 12 F3 FE 3A CF 5C E2 E7 E2
03 93 93 93 FD BA 8E 79 E6 39 19 8E FB EB DC 15 0B E6 F9 D5 61 7E 3F 30 CF 5C 62 DE 5F E7 99 4B
FC 1F 94 BD 62 D3 EE A5 8B 6B 00 00 00 00 49 45 4E 44 AE 42 60 82 11
FC 1F 94 BD 62 D3 EE A5 8B 6B 00 00 00 00 49 45 4E 44 AE 42 60 82 10
EndData
$EndBitmap
Wire Bus Line
......@@ -1794,7 +1794,7 @@ U 1 1 4A087146
P 5250 1950
F 0 "U3" H 5250 2525 60 0000 C BNN
F 1 "74LS541" H 5250 1375 60 0000 C TNN
F 2 "" H 5250 1950 60 0001 C CNN
F 2 "DIP-20__300" H 5250 1250 60 0000 C CNN
F 3 "" H 5250 1950 60 0001 C CNN
1 5250 1950
1 0 0 -1
......@@ -2049,7 +2049,7 @@ U 1 1 32568D1E
P 1700 7250
F 0 "JP1" H 1700 7750 70 0000 C CNN
F 1 "CONN_8X2" V 1700 7250 70 0000 C CNN
F 2 "pin_array_8x2" H 1700 7800 60 0000 C CNN
F 2 "pin_array_8x2" H 1700 7850 60 0000 C CNN
F 3 "" H 1700 7250 60 0001 C CNN
1 1700 7250
1 0 0 1
......@@ -2384,7 +2384,7 @@ U 1 1 3240023F
P 7700 9050
F 0 "U5" H 7750 10200 70 0000 C CNN
F 1 "628128" H 7700 7900 70 0000 C CNN
F 2 "32dip600" H 7700 7800 60 0000 C CNN
F 2 "DIP-32__600" H 7700 7800 60 0000 C CNN
F 3 "" H 7700 9050 60 0001 C CNN
1 7700 9050
1 0 0 -1
......@@ -2742,7 +2742,7 @@ U 1 1 322D35B4
P 4600 6900
F 0 "U2" H 4600 7850 60 0000 C CNN
F 1 "74LS688" H 4600 5950 60 0000 C CIB
F 2 "20dip300" H 4600 5850 60 0000 C CNB
F 2 "DIP-20__300" H 4600 5850 60 0000 C CNB
F 3 "" H 4600 6900 60 0001 C CNN
1 4600 6900
1 0 0 -1
......@@ -2809,8 +2809,8 @@ L EP600 U8
U 1 1 322D321C
P 7650 1800
F 0 "U8" H 7650 1900 70 0000 C CNN
F 1 "EP600" H 7650 1300 70 0000 C CNN
F 2 "24dip300" H 7700 1000 60 0000 C CNN
F 1 "EP600" H 7650 850 70 0000 C CNN
F 2 "DIP-24__300" H 7700 750 60 0000 C CNN
F 3 "" H 7650 1800 60 0001 C CNN
1 7650 1800
1 0 0 -1
......@@ -2821,7 +2821,7 @@ U 1 1 322D31F4
P 5200 3600
F 0 "U1" H 5300 4175 60 0000 L BNN
F 1 "74LS245" H 5250 3025 60 0000 L TNN
F 2 "20dip300" H 5350 3100 60 0000 C CNN
F 2 "DIP-20__300" H 5400 2900 60 0000 C CNN
F 3 "" H 5200 3600 60 0001 C CNN
1 5200 3600
1 0 0 -1
......@@ -2830,9 +2830,9 @@ $Comp
L BUSPC BUS1
U 1 1 322D3011
P 2250 2950
F 0 "BUS1" H 2250 3050 70 0000 C CNN
F 1 "BUSPC" H 2250 2850 70 0000 C CNN
F 2 "BUS_PC" H 2250 1250 60 0000 C CNN
F 0 "BUS1" H 2200 4600 70 0000 C CNN
F 1 "BUSPC" H 2200 1250 70 0000 C CNN
F 2 "BUS_PC" H 2202 1160 60 0000 C CNN
F 3 "" H 2250 2950 60 0001 C CNN
1 2250 2950
1 0 0 -1
......
......@@ -47,9 +47,18 @@ class wxTextCtrl;
* <li> know too much about the caller's UI, i.e. wx. </li>
* <li> stop after the first error </li>
* </ul>
* the reporter has 3 levels (flags) for filtering:
* no filter
* report warning
* report errors
* They are indicators for the calling code, filtering is not made here
*/
class REPORTER
{
bool m_reportAll; // Filter flag: set to true to report all messages
bool m_reportWarnings; // Filter flag: set to true to report warning
bool m_reportErrors; // Filter flag: set to true to report errors
public:
/**
* Function Report
......@@ -68,6 +77,41 @@ public:
REPORTER& operator <<( wxChar aChar ) { return Report( wxString( aChar ) ); }
REPORTER& operator <<( const char* aText ) { return Report( aText ); }
/**
* Returns true if all messages should be reported
*/
bool ReportAll() { return m_reportAll; }
/**
* Returns true if all messages or warning messages should be reported
*/
bool ReportWarnings() { return m_reportAll | m_reportWarnings; }
/**
* Returns true if all messages or error messages should be reported
*/
bool ReportErrors() { return m_reportAll | m_reportErrors; }
/**
* Set the report filter state, for all messages
* @param aEnable = filter state (true/false)
*/
void SetReportAll( bool aEnable) { m_reportAll = aEnable; }
/**
* Set the report filter state, for warning messages
* note: report can be disable only if m_reportAll = false
* @param aEnable = filter state (true/false)
*/
void SetReportWarnings( bool aEnable) { m_reportWarnings = aEnable; }
/**
* Set the report filter state, for error messages
* note: report can be disable only if m_reportAll = false
* @param aEnable = filter state (true/false)
*/
void SetReportErrors( bool aEnable) { m_reportErrors = aEnable; }
};
......@@ -84,6 +128,9 @@ public:
REPORTER(),
m_textCtrl( aTextCtrl )
{
SetReportAll( true );
SetReportWarnings( true );
SetReportErrors( true );
}
REPORTER& Report( const wxString& aText );
......
......@@ -2368,7 +2368,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, REPORTER* aReporter )
{
component = aNetlist.GetComponent( i );
if( aReporter )
if( aReporter && aReporter->ReportAll() )
{
msg.Printf( _( "Checking netlist component footprint \"%s:%s:%s\".\n" ),
GetChars( component->GetReference() ),
......@@ -2387,18 +2387,26 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, REPORTER* aReporter )
if( aReporter )
{
if( component->GetModule() != NULL )
{
msg.Printf( _( "Adding new component \"%s:%s\" footprint \"%s\".\n" ),
GetChars( component->GetReference() ),
GetChars( component->GetTimeStamp() ),
GetChars( component->GetFootprintName() ) );
if( aReporter->ReportWarnings() )
aReporter->Report( msg );
}
else
{
msg.Printf( _( "Cannot add new component \"%s:%s\" due to missing "
"footprint \"%s\".\n" ),
GetChars( component->GetReference() ),
GetChars( component->GetTimeStamp() ),
GetChars( component->GetFootprintName() ) );
aReporter->Report( msg );
if( aReporter->ReportErrors() )
aReporter->Report( msg );
}
}
if( !aNetlist.IsDryRun() && (component->GetModule() != NULL) )
......@@ -2422,20 +2430,28 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, REPORTER* aReporter )
if( aReporter )
{
if( component->GetModule() != NULL )
{
msg.Printf( _( "Replacing component \"%s:%s\" footprint \"%s\" with "
"\"%s\".\n" ),
GetChars( footprint->GetReference() ),
GetChars( footprint->GetPath() ),
GetChars( footprint->GetLibRef() ),
GetChars( component->GetFootprintName() ) );
if( aReporter->ReportWarnings() )
aReporter->Report( msg );
}
else
{
msg.Printf( _( "Cannot replace component \"%s:%s\" due to missing "
"footprint \"%s\".\n" ),
GetChars( footprint->GetReference() ),
GetChars( footprint->GetPath() ),
GetChars( component->GetFootprintName() ) );
aReporter->Report( msg );
if( aReporter->ReportErrors() )
aReporter->Report( msg );
}
}
if( !aNetlist.IsDryRun() && (component->GetModule() != NULL) )
......@@ -2459,7 +2475,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, REPORTER* aReporter )
// Test for reference designator field change.
if( footprint->GetReference() != component->GetReference() )
{
if( aReporter )
if( aReporter && aReporter->ReportWarnings())
{
msg.Printf( _( "Changing footprint \"%s:%s\" reference to \"%s\".\n" ),
GetChars( footprint->GetReference() ),
......@@ -2475,7 +2491,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, REPORTER* aReporter )
// Test for value field change.
if( footprint->GetValue() != component->GetValue() )
{
if( aReporter )
if( aReporter && aReporter->ReportAll() )
{
msg.Printf( _( "Changing footprint \"%s:%s\" value from \"%s\" to \"%s\".\n" ),
GetChars( footprint->GetReference() ),
......@@ -2492,7 +2508,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, REPORTER* aReporter )
// Test for time stamp change.
if( footprint->GetPath() != component->GetTimeStamp() )
{
if( aReporter )
if( aReporter && aReporter->ReportWarnings() )
{
msg.Printf( _( "Changing footprint path \"%s:%s\" to \"%s\".\n" ),
GetChars( footprint->GetReference() ),
......@@ -2518,7 +2534,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, REPORTER* aReporter )
{
if( !pad->GetNetname().IsEmpty() )
{
if( aReporter )
if( aReporter && aReporter->ReportAll() )
{
msg.Printf( _( "Clearing component \"%s:%s\" pin \"%s\" net name.\n" ),
GetChars( footprint->GetReference() ),
......@@ -2535,7 +2551,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, REPORTER* aReporter )
{
if( net.GetNetName() != pad->GetNetname() )
{
if( aReporter )
if( aReporter && aReporter->ReportAll() )
{
msg.Printf( _( "Changing component \"%s:%s\" pin \"%s\" net name from "
"\"%s\" to \"%s\".\n" ),
......@@ -2573,7 +2589,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, REPORTER* aReporter )
if( component == NULL )
{
if( aReporter )
if( aReporter && aReporter->ReportWarnings() )
{
msg.Printf( _( "Removing footprint \"%s:%s\".\n" ),
GetChars( module->GetReference() ),
......
......@@ -46,6 +46,7 @@
#include <dialog_netlist.h>
#define NETLIST_SILENTMODE_KEY wxT("SilentMode")
#define NETLIST_FULLMESSAGES_KEY wxT("NetlistReportAllMsg")
void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC )
{
......@@ -95,9 +96,11 @@ DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC,
m_dc = aDC;
m_config = wxGetApp().GetSettings();
m_silentMode = m_config->Read( NETLIST_SILENTMODE_KEY, 0l );
m_reportAll = m_config->Read( NETLIST_FULLMESSAGES_KEY, 1l );
m_NetlistFilenameCtrl->SetValue( aNetlistFullFilename );
m_cmpNameSourceOpt->SetSelection( m_parent->GetUseCmpFileForFpNames() ? 1 : 0 );
m_checkBoxSilentMode->SetValue( m_silentMode );
m_checkBoxFullMessages->SetValue( m_reportAll );
GetSizer()->SetSizeHints( this );
}
......@@ -105,6 +108,7 @@ DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC,
DIALOG_NETLIST::~DIALOG_NETLIST()
{
m_config->Write( NETLIST_SILENTMODE_KEY, (long) m_silentMode );
m_config->Write( NETLIST_FULLMESSAGES_KEY, (long) m_reportAll );
}
void DIALOG_NETLIST::OnOpenNetlistClick( wxCommandEvent& event )
......@@ -176,6 +180,7 @@ void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event )
}
WX_TEXT_CTRL_REPORTER reporter( m_MessageWindow );
reporter.SetReportAll( m_reportAll );
m_parent->ReadPcbNetlist( netlistFileName, cmpFileName, &reporter,
m_ChangeExistingFootprintCtrl->GetSelection() == 1,
......
......@@ -40,7 +40,9 @@ class DIALOG_NETLIST : public DIALOG_NETLIST_FBP
private:
PCB_EDIT_FRAME* m_parent;
wxDC* m_dc;
bool m_silentMode;
bool m_silentMode; // if true, do not display warning message about undo
bool m_reportAll; // If true report all messages,
// false, report only warnings or errors
wxConfig* m_config;
public:
......@@ -96,6 +98,10 @@ private:
{
m_silentMode = m_checkBoxSilentMode->GetValue();
}
void OnClickFullMessages( wxCommandEvent& event )
{
m_reportAll = m_checkBoxFullMessages->GetValue();
}
void OnUpdateUISaveMessagesToFile( wxUpdateUIEvent& aEvent );
void OnUpdateUIValidNetlistFile( wxUpdateUIEvent& aEvent );
......
......@@ -72,7 +72,7 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w
m_RemoveExtraFootprintsCtrl->SetSelection( 0 );
m_RemoveExtraFootprintsCtrl->SetToolTip( _("Remove footprints found on the Board but not in netlist\nNote: only not locked footprints will be removed") );
bTracksSizer->Add( m_RemoveExtraFootprintsCtrl, 0, wxALL|wxEXPAND, 5 );
bTracksSizer->Add( m_RemoveExtraFootprintsCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bnetlistOptSizer->Add( bTracksSizer, 1, wxEXPAND, 5 );
......@@ -80,31 +80,12 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w
bleftSizer->Add( bnetlistOptSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bCenterSizer;
bCenterSizer = new wxBoxSizer( wxVERTICAL );
m_checkDryRun = new wxCheckBox( this, wxID_ANY, _("Dry run. Only report changes in message panel"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkDryRun->SetToolTip( _("Dry Run:\nThe netlist is read, but no change is actually made on board.\nChanges are only reported in message panel, for info") );
bCenterSizer->Add( m_checkDryRun, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkBoxSilentMode = new wxCheckBox( this, wxID_ANY, _("Silent mode"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxSilentMode->SetToolTip( _("Silent mode:\nDo not show the warning message before reading the netlist") );
bCenterSizer->Add( m_checkBoxSilentMode, 0, wxRIGHT|wxLEFT, 5 );
bleftSizer->Add( bCenterSizer, 0, wxALL|wxEXPAND, 5 );
bUpperSizer->Add( bleftSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bRightSizerButtons;
bRightSizerButtons = new wxBoxSizer( wxVERTICAL );
m_buttonBrowse = new wxButton( this, ID_OPEN_NELIST, _("Browse Netlist Files"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizerButtons->Add( m_buttonBrowse, 0, wxEXPAND|wxALL, 5 );
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") );
......@@ -128,28 +109,62 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w
bRightSizerButtons->Add( m_buttonSaveMessages, 0, wxALL|wxEXPAND, 5 );
bUpperSizer->Add( bRightSizerButtons, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
bUpperSizer->Add( bRightSizerButtons, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
bMainSizer->Add( bUpperSizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bLowerSizer;
bLowerSizer = new wxBoxSizer( wxVERTICAL );
m_staticline11 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline11, 0, wxEXPAND | wxALL, 5 );
wxBoxSizer* bCenterSizer;
bCenterSizer = new wxBoxSizer( wxVERTICAL );
m_checkDryRun = new wxCheckBox( this, wxID_ANY, _("Dry run. Only report changes in message panel"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkDryRun->SetToolTip( _("Dry Run:\nThe netlist is read, but no change is actually made on board.\nChanges are only reported in message panel, for info") );
bCenterSizer->Add( m_checkDryRun, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkBoxSilentMode = new wxCheckBox( this, wxID_ANY, _("Silent mode"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxSilentMode->SetToolTip( _("Silent mode:\nDo not show the warning message before reading the netlist") );
bCenterSizer->Add( m_checkBoxSilentMode, 0, wxRIGHT|wxLEFT, 5 );
m_checkBoxFullMessages = new wxCheckBox( this, wxID_ANY, _("Display all messages"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxFullMessages->SetValue(true);
m_checkBoxFullMessages->SetToolTip( _("Messages filter:\nIf checked: show all messages when reading the netlist\nIf not checked: show only warning or error messages") );
bCenterSizer->Add( m_checkBoxFullMessages, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
bMainSizer->Add( bCenterSizer, 0, wxALL|wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bLowerSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
wxBoxSizer* bLowerSizer;
bLowerSizer = new wxBoxSizer( wxVERTICAL );
m_staticTextNetfilename = new wxStaticText( this, wxID_ANY, _("Netlist File:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextNetfilename->Wrap( -1 );
bLowerSizer->Add( m_staticTextNetfilename, 0, wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerNetlistFilename;
bSizerNetlistFilename = new wxBoxSizer( wxHORIZONTAL );
m_NetlistFilenameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_NetlistFilenameCtrl->SetMaxLength( 0 );
bLowerSizer->Add( m_NetlistFilenameCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerNetlistFilename->Add( m_NetlistFilenameCtrl, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_buttonBrowse = new wxButton( this, ID_OPEN_NELIST, _("Browse"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
bSizerNetlistFilename->Add( m_buttonBrowse, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bLowerSizer->Add( bSizerNetlistFilename, 0, wxEXPAND, 5 );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
bLowerSizer->Add( m_staticText1, 0, wxRIGHT|wxLEFT, 5 );
bLowerSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_MessageWindow = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_CHARWRAP|wxTE_MULTILINE|wxTE_READONLY|wxTE_WORDWRAP );
m_MessageWindow->SetMaxLength( 0 );
......@@ -166,8 +181,6 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w
bMainSizer->Fit( this );
// Connect Events
m_checkBoxSilentMode->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnClickSilentMode ), 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_buttonRead->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_NETLIST_FBP::OnUpdateUIValidNetlistFile ), NULL, this );
m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnCancelClick ), NULL, this );
......@@ -177,13 +190,14 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w
m_buttonRebild->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_NETLIST_FBP::OnUpdateUIValidNetlistFile ), NULL, this );
m_buttonSaveMessages->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnSaveMessagesToFile ), NULL, this );
m_buttonSaveMessages->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_NETLIST_FBP::OnUpdateUISaveMessagesToFile ), NULL, this );
m_checkBoxSilentMode->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnClickSilentMode ), NULL, this );
m_checkBoxFullMessages->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnClickFullMessages ), NULL, this );
m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnOpenNetlistClick ), NULL, this );
}
DIALOG_NETLIST_FBP::~DIALOG_NETLIST_FBP()
{
// Disconnect Events
m_checkBoxSilentMode->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnClickSilentMode ), 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_buttonRead->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_NETLIST_FBP::OnUpdateUIValidNetlistFile ), NULL, this );
m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnCancelClick ), NULL, this );
......@@ -193,5 +207,8 @@ DIALOG_NETLIST_FBP::~DIALOG_NETLIST_FBP()
m_buttonRebild->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_NETLIST_FBP::OnUpdateUIValidNetlistFile ), NULL, this );
m_buttonSaveMessages->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnSaveMessagesToFile ), NULL, this );
m_buttonSaveMessages->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_NETLIST_FBP::OnUpdateUISaveMessagesToFile ), NULL, this );
m_checkBoxSilentMode->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnClickSilentMode ), NULL, this );
m_checkBoxFullMessages->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnClickFullMessages ), NULL, this );
m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnOpenNetlistClick ), NULL, this );
}
This diff is collapsed.
......@@ -21,9 +21,9 @@ class DIALOG_SHIM;
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/statline.h>
#include <wx/checkbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/dialog.h>
......@@ -40,10 +40,10 @@ class DIALOG_NETLIST_FBP : public DIALOG_SHIM
protected:
enum
{
ID_OPEN_NELIST = 1000,
ID_READ_NETLIST_FILE,
ID_READ_NETLIST_FILE = 1000,
ID_TEST_NETLIST,
ID_COMPILE_RATSNEST
ID_COMPILE_RATSNEST,
ID_OPEN_NELIST
};
wxRadioBox* m_Select_By_Timestamp;
......@@ -51,23 +51,23 @@ class DIALOG_NETLIST_FBP : public DIALOG_SHIM
wxRadioBox* m_ChangeExistingFootprintCtrl;
wxRadioBox* m_DeleteBadTracks;
wxRadioBox* m_RemoveExtraFootprintsCtrl;
wxCheckBox* m_checkDryRun;
wxCheckBox* m_checkBoxSilentMode;
wxButton* m_buttonBrowse;
wxButton* m_buttonRead;
wxButton* m_buttonClose;
wxButton* m_buttonFPTest;
wxButton* m_buttonRebild;
wxButton* m_buttonSaveMessages;
wxStaticLine* m_staticline11;
wxCheckBox* m_checkDryRun;
wxCheckBox* m_checkBoxSilentMode;
wxCheckBox* m_checkBoxFullMessages;
wxStaticLine* m_staticline1;
wxStaticText* m_staticTextNetfilename;
wxTextCtrl* m_NetlistFilenameCtrl;
wxButton* m_buttonBrowse;
wxStaticText* m_staticText1;
wxTextCtrl* m_MessageWindow;
// Virtual event handlers, overide them in your derived class
virtual void OnClickSilentMode( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOpenNetlistClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnReadNetlistFileClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUpdateUIValidNetlistFile( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
......@@ -75,6 +75,9 @@ class DIALOG_NETLIST_FBP : public DIALOG_SHIM
virtual void OnCompileRatsnestClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSaveMessagesToFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUpdateUISaveMessagesToFile( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnClickSilentMode( wxCommandEvent& event ) { event.Skip(); }
virtual void OnClickFullMessages( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOpenNetlistClick( wxCommandEvent& event ) { event.Skip(); }
public:
......
......@@ -122,6 +122,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_SELECT_LAYER_PAIR:
case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
case ID_POPUP_PCB_MOVE_TRACK_NODE:
case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE:
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
case ID_POPUP_PCB_MOVE_TRACK_SEGMENT:
......@@ -145,6 +146,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_EDIT_DRAWING:
case ID_POPUP_PCB_GETINFO_MARKER:
case ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST:
case ID_POPUP_PCB_DRAG_MODULE_REQUEST:
case ID_POPUP_PCB_MOVE_MODULE_REQUEST:
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
case ID_POPUP_PCB_MOVE_MIRE_REQUEST:
break;
case ID_POPUP_CANCEL_CURRENT_COMMAND:
......@@ -286,11 +291,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
InstallNetlistFrame( &dc );
break;
case ID_GET_TOOLS:
// InstalloolsFrame(this, wxPoint(-1,-1) );
break;
case ID_FIND_ITEMS:
InstallFindFrame();
break;
......
......@@ -56,6 +56,11 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName,
NETLIST netlist;
NETLIST_READER* netlistReader;
netlist.SetIsDryRun( aIsDryRun );
netlist.SetFindByTimeStamp( aSelectByTimeStamp );
netlist.SetDeleteExtraFootprints( aDeleteExtraFootprints );
netlist.SetReplaceFootprints( aChangeFootprints );
try
{
netlistReader = NETLIST_READER::GetNetlistReader( &netlist, aNetlistFileName,
......@@ -80,11 +85,6 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName,
return;
}
netlist.SetIsDryRun( aIsDryRun );
netlist.SetFindByTimeStamp( aSelectByTimeStamp );
netlist.SetDeleteExtraFootprints( aDeleteExtraFootprints );
netlist.SetReplaceFootprints( aChangeFootprints );
// Clear undo and redo lists to avoid inconsistencies between lists
if( !netlist.IsDryRun() )
GetScreen()->ClearUndoRedoList();
......@@ -164,7 +164,6 @@ MODULE* PCB_EDIT_FRAME::ListAndSelectModuleName()
void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
throw( IO_ERROR, PARSE_ERROR )
{
bool loadFootprint;
wxString msg;
wxString lastFootprintLibName;
COMPONENT* component;
......@@ -204,8 +203,27 @@ void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
else
fpOnBoard = m_Pcb->FindModule( aNetlist.GetComponent( ii )->GetReference() );
loadFootprint = (fpOnBoard == NULL) ||
(fpOnBoard->GetPath() != component->GetFootprintName());
bool footprintMisMatch = fpOnBoard &&
fpOnBoard->GetLibRef() != component->GetFootprintName();
if( footprintMisMatch && !aNetlist.GetReplaceFootprints() )
{
if( aReporter )
{
msg.Printf( _( "* Warning: component `%s` has footprint <%s> and should be <%s>\n" ),
GetChars( component->GetReference() ),
GetChars( fpOnBoard->GetLibRef() ),
GetChars( component->GetFootprintName() ) );
aReporter->Report( msg );
}
continue;
}
if( !aNetlist.GetReplaceFootprints() )
footprintMisMatch = false;
bool loadFootprint = (fpOnBoard == NULL) || footprintMisMatch;
if( loadFootprint && (component->GetFootprintName() != lastFootprintLibName) )
{
......@@ -244,7 +262,6 @@ void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
{
if( aReporter )
{
wxString msg;
msg.Printf( _( "*** Warning: component `%s` footprint <%s> was not found in "
"any libraries. ***\n" ),
GetChars( component->GetReference() ),
......@@ -274,7 +291,6 @@ void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
throw( IO_ERROR, PARSE_ERROR )
{
bool loadFootprint;
wxString msg;
wxString lastFootprintLibName;
COMPONENT* component;
......@@ -309,8 +325,27 @@ void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
else
fpOnBoard = m_Pcb->FindModule( aNetlist.GetComponent( ii )->GetReference() );
loadFootprint = (fpOnBoard == NULL) ||
(fpOnBoard->GetPath() != component->GetFootprintName());
bool footprintMisMatch = fpOnBoard &&
fpOnBoard->GetLibRef() != component->GetFootprintName();
if( footprintMisMatch && !aNetlist.GetReplaceFootprints() )
{
if( aReporter )
{
msg.Printf( _( "* Warning: component `%s` has footprint <%s> and should be <%s>\n" ),
GetChars( component->GetReference() ),
GetChars( fpOnBoard->GetLibRef() ),
GetChars( component->GetFootprintName() ) );
aReporter->Report( msg );
}
continue;
}
if( !aNetlist.GetReplaceFootprints() )
footprintMisMatch = false;
bool loadFootprint = (fpOnBoard == NULL) || footprintMisMatch;
if( loadFootprint && (component->GetFootprintName() != lastFootprintLibName) )
{
......
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