From ae12e698605bc708c633b281303b025651979aa8 Mon Sep 17 00:00:00 2001 From: charras Date: Tue, 13 Oct 2009 16:29:02 +0000 Subject: [PATCH] fixed a minor problem in pcbnew compiled in DEBUG mode, that prints a lot of error messages when loading a board --- pcbnew/class_board.cpp | 3 ++- pcbnew/class_netinfo_item.cpp | 9 --------- pcbnew/class_netinfolist.cpp | 10 ++++++++++ pcbnew/ioascii.cpp | 13 ++++++++----- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 1b1743d3e4..9719ccb4c5 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -890,7 +890,8 @@ NETINFO_ITEM* BOARD::FindNet( int anetcode ) const { if( anetcode != net->GetNet() ) { - printf("FindNet() anetcode %d != GetNet() %d\n", anetcode, net->GetNet()); + printf("FindNet() anetcode %d != GetNet() %d (net: %s)\n", + anetcode, net->GetNet(), CONV_TO_UTF8(net->GetNetname())); } } #endif diff --git a/pcbnew/class_netinfo_item.cpp b/pcbnew/class_netinfo_item.cpp index 0f0da330c6..fc1aa9f8c0 100644 --- a/pcbnew/class_netinfo_item.cpp +++ b/pcbnew/class_netinfo_item.cpp @@ -62,15 +62,6 @@ int NETINFO_ITEM:: ReadDescr( FILE* File, int* LineNum ) m_Netname = CONV_FROM_UTF8( Ltmp ); continue; } - - /* - if( strncmp( Line, "NetClass", 8 ) == 0 ) - { - ReadDelimitedText( Ltmp, Line + 8, sizeof(Ltmp) ); - m_NetClassName = CONV_FROM_UTF8( Ltmp ); - continue; - } - */ } return 1; diff --git a/pcbnew/class_netinfolist.cpp b/pcbnew/class_netinfolist.cpp index ff782e107c..6acd6ade0c 100644 --- a/pcbnew/class_netinfolist.cpp +++ b/pcbnew/class_netinfolist.cpp @@ -139,6 +139,16 @@ void NETINFO_LIST::BuildListOfNets() m_Parent->m_Status_Pcb |= NET_CODES_OK; m_Parent->SetAreasNetCodesFromNetNames(); + +// For test and debug purposes only +#if 0 + for( unsigned icnt = 0; icnt < GetCount(); icnt++) + { + wxLogWarning(wxT("icnt %d, netcode %d, netname <%s>\n"), + icnt, m_NetBuffer[icnt]->GetNet(), + GetChars( m_NetBuffer[icnt]->GetNetname() ) ); + } +#endif } diff --git a/pcbnew/ioascii.cpp b/pcbnew/ioascii.cpp index d8f57c4357..088a633bf0 100644 --- a/pcbnew/ioascii.cpp +++ b/pcbnew/ioascii.cpp @@ -997,13 +997,15 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append ) SetLocaleTo_Default( ); // revert to the current locale - Affiche_Message( wxEmptyString ); - - BestZoom(); + GetBoard()->m_Status_Pcb = 0; + // Build the net info list + GetBoard()->m_NetInfo->BuildListOfNets(); board->SynchronizeNetsAndNetClasses( ); - board->m_Status_Pcb = 0; + m_TrackAndViasSizesList_Changed = true; + Affiche_Message( wxEmptyString ); + BestZoom(); SetToolbars(); return 1; } @@ -1036,7 +1038,8 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile ) fprintf( aFile, "# Created by Pcbnew%s\n\n", CONV_TO_UTF8( GetBuildVersion() ) ); GetBoard()->SynchronizeNetsAndNetClasses(); - // Select default Netclass. Useful to save default values in headers + // Select default Netclass before writing file. + // Useful to save default values in headers GetBoard()->SetCurrentNetClass( GetBoard()->m_NetClasses.GetDefault()->GetName( )); m_TrackAndViasSizesList_Changed = true; AuxiliaryToolBar_Update_UI();