Repair board on open

We need to ensure that boards do not have duplicated KIIDs, so we repair
the duplicates when opening an existing file.  This does not change the
file on disk until saved
This commit is contained in:
Seth Hillbrand 2021-05-28 16:43:46 -07:00
parent 74e4370a9b
commit 63cc7d16b4
2 changed files with 8 additions and 2 deletions

View File

@ -55,6 +55,8 @@
#include <plugins/cadstar/cadstar_pcb_archive_plugin.h>
#include <plugins/kicad/kicad_plugin.h>
#include <dialogs/dialog_imported_layers.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include "footprint_info_impl.h"
#include <wx/wupdlock.h>
@ -768,6 +770,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// we should not ask PLUGINs to do these items:
loadedBoard->BuildListOfNets();
ResolveDRCExclusions();
m_toolManager->RunAction( PCB_ACTIONS::repairBoard, true, true);
if( loadedBoard->IsModified() )
OnModify();

View File

@ -496,6 +496,7 @@ int BOARD_EDITOR_CONTROL::RepairBoard( const TOOL_EVENT& aEvent )
{
int errors = 0;
wxString details;
bool quiet = aEvent.Parameter<bool>();
/*******************************
* Repair duplicate IDs and missing nets
@ -598,9 +599,11 @@ int BOARD_EDITOR_CONTROL::RepairBoard( const TOOL_EVENT& aEvent )
m_frame->OnModify();
wxString msg = wxString::Format( _( "%d potential problems repaired." ), errors );
DisplayInfoMessage( m_frame, msg, details );
if( !quiet )
DisplayInfoMessage( m_frame, msg, details );
}
else
else if( !quiet )
{
DisplayInfoMessage( m_frame, _( "No board problems found." ) );
}