Don't allow two DRC runs at the same time.

Fixes https://gitlab.com/kicad/code/kicad/issues/5745
This commit is contained in:
Jeff Young 2020-09-23 11:36:27 +01:00
parent 7d3eee8cf9
commit 167ae374fd
5 changed files with 32 additions and 20 deletions

View File

@ -76,11 +76,11 @@ DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
m_cbTestFootprints->Hide();
// We use a sdbSizer here to get the order right, which is platform-dependent
m_sdbSizer1OK->SetLabel( _( "Run DRC" ) );
m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
m_sdbSizerOK->SetLabel( _( "Run DRC" ) );
m_sdbSizerCancel->SetLabel( _( "Close" ) );
m_sizerButtons->Layout();
m_sdbSizer1OK->SetDefault();
m_sdbSizerOK->SetDefault();
initValues();
syncCheckboxes();
@ -219,7 +219,10 @@ void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent )
wxYield(); // Allow time slice to refresh Messages
m_running = true;
m_sdbSizer1Cancel->SetLabel( _( "Cancel" ) );
m_sdbSizerCancel->SetLabel( _( "Cancel" ) );
m_sdbSizerOK->Enable( false );
m_DeleteCurrentMarkerButton->Enable( false );
m_DeleteAllMarkersButton->Enable( false );
m_saveReport->Enable( false );
drcTool->RunTests( this, testTracksAgainstZones, refillZones, reportAllTrackErrors,
@ -234,7 +237,10 @@ void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent )
wxYield(); // Allow time slice to refresh Messages
m_running = false;
m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
m_sdbSizerCancel->SetLabel( _( "Close" ) );
m_sdbSizerOK->Enable( true );
m_DeleteCurrentMarkerButton->Enable( true );
m_DeleteAllMarkersButton->Enable( true );
m_saveReport->Enable( true );
if( !m_cancelled )

View File

@ -202,14 +202,14 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
m_DeleteAllMarkersButton = new wxButton( this, wxID_ANY, _("Delete All Markers"), wxDefaultPosition, wxDefaultSize, 0 );
m_sizerButtons->Add( m_DeleteAllMarkersButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
m_sizerButtons->Add( m_sdbSizer1, 1, wxEXPAND|wxALL, 5 );
m_sizerButtons->Add( m_sdbSizer, 1, wxEXPAND|wxALL, 5 );
m_MainSizer->Add( m_sizerButtons, 0, wxEXPAND|wxLEFT, 5 );
@ -237,8 +237,8 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
m_saveReport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSaveReport ), NULL, this );
m_DeleteCurrentMarkerButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnDeleteOneClick ), NULL, this );
m_DeleteAllMarkersButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnDeleteAllClick ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnRunDRCClick ), NULL, this );
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnRunDRCClick ), NULL, this );
}
DIALOG_DRC_BASE::~DIALOG_DRC_BASE()
@ -261,7 +261,7 @@ DIALOG_DRC_BASE::~DIALOG_DRC_BASE()
m_saveReport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSaveReport ), NULL, this );
m_DeleteCurrentMarkerButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnDeleteOneClick ), NULL, this );
m_DeleteAllMarkersButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnDeleteAllClick ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnRunDRCClick ), NULL, this );
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnRunDRCClick ), NULL, this );
}

View File

@ -1965,7 +1965,7 @@
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizer1</property>
<property name="name">m_sdbSizer</property>
<property name="permission">protected</property>
<event name="OnCancelButtonClick">OnCancelClick</event>
<event name="OnOKButtonClick">OnRunDRCClick</event>

View File

@ -76,9 +76,9 @@ class DIALOG_DRC_BASE : public DIALOG_SHIM
wxBoxSizer* m_sizerButtons;
wxButton* m_DeleteCurrentMarkerButton;
wxButton* m_DeleteAllMarkersButton;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnActivateDlg( wxActivateEvent& event ) { event.Skip(); }

View File

@ -132,6 +132,12 @@ void DRC_TOOL::DestroyDRCDialog()
void DRC_TOOL::RunTests( PROGRESS_REPORTER* aProgressReporter, bool aTestTracksAgainstZones,
bool aRefillZones, bool aReportAllTrackErrors, bool aTestFootprints )
{
// One at a time, please.
// Note that the main GUI entry points to get here are blocked, so this is really an
// insurance policy and as such we make no attempts to queue up the DRC run or anything.
if( m_drcRunning )
return;
ZONE_FILLER_TOOL* zoneFiller = m_toolMgr->GetTool<ZONE_FILLER_TOOL>();
BOARD_COMMIT commit( m_editFrame );
NETLIST netlist;