KiCad PCB EDA Suite
dialog_drc.cpp
Go to the documentation of this file.
1 
5 /*
6  * This program source code file is part of KiCad, a free EDA CAD application.
7  *
8  * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
9  * Copyright (C) 2009-2016 Dick Hollenbeck, dick@softplc.com
10  * Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, you may find one here:
24  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
25  * or you may search the http://www.gnu.org website for the version 2 license,
26  * or you may write to the Free Software Foundation, Inc.,
27  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
28  */
29 
30 #include <fctsys.h>
31 #include <kiface_i.h>
32 #include <confirm.h>
34 #include <pgm_base.h>
35 #include <dialog_drc.h>
36 #include <pcb_edit_frame.h>
37 #include <base_units.h>
38 #include <board_design_settings.h>
39 #include <class_draw_panel_gal.h>
40 #include <view/view.h>
41 
42 /* class DIALOG_DRC_CONTROL: a dialog to set DRC parameters (clearance, min cooper size)
43  * and run DRC tests
44  */
45 
46 // Keywords for read and write config
47 #define TestMissingCourtyardKey wxT( "TestMissingCourtyard" )
48 #define TestFootprintCourtyardKey wxT( "TestFootprintCourtyard" )
49 #define RefillZonesBeforeDrc wxT( "RefillZonesBeforeDrc" )
50 
51 
53  wxWindow* aParent ) :
54  DIALOG_DRC_CONTROL_BASE( aParent )
55 {
57  m_tester = aTester;
58  m_brdEditor = aEditorFrame;
61 
62  InitValues();
63 
64  // Now all widgets have the size fixed, call FinishDialogSettings
66 }
67 
69 {
72  m_config->Write( RefillZonesBeforeDrc, m_cbRefillZones->GetValue() );
73 
74  // Disonnect events
75  m_ClearanceListBox->Disconnect( ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK,
76  wxMouseEventHandler(
78  m_ClearanceListBox->Disconnect( ID_CLEARANCE_LIST, wxEVT_RIGHT_UP,
79  wxMouseEventHandler(
81  m_UnconnectedListBox->Disconnect( ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK,
82  wxMouseEventHandler( DIALOG_DRC_CONTROL::
83  OnLeftDClickUnconnected ), NULL, this );
84  m_UnconnectedListBox->Disconnect( ID_UNCONNECTED_LIST, wxEVT_RIGHT_UP,
85  wxMouseEventHandler(
87 
88  this->Disconnect( wxEVT_MENU, wxCommandEventHandler( DIALOG_DRC_CONTROL::OnPopupMenu ), NULL, this );
89 }
90 
91 void DIALOG_DRC_CONTROL::OnActivateDlg( wxActivateEvent& event )
92 {
94  {
95  // If m_currentBoard is not the current parent board,
96  // (for instance because a new board was loaded),
97  // close the dialog, because many pointers are now invalid
98  // in lists
99  SetReturnCode( wxID_CANCEL );
100  Close();
101  m_tester->DestroyDRCDialog( wxID_CANCEL );
102  return;
103  }
104 
105  // updating data which can be modified outside the dialog (DRC parameters, units ...)
106  // because the dialog is not modal
109 }
110 
111 
113 {
117 
121 }
122 
123 
125 {
126  // Connect events and objects
127  m_ClearanceListBox->Connect( ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK,
128  wxMouseEventHandler(
130  m_ClearanceListBox->Connect( ID_CLEARANCE_LIST, wxEVT_RIGHT_UP,
131  wxMouseEventHandler(
133  m_UnconnectedListBox->Connect( ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK,
134  wxMouseEventHandler( DIALOG_DRC_CONTROL::
135  OnLeftDClickUnconnected ), NULL, this );
136  m_UnconnectedListBox->Connect( ID_UNCONNECTED_LIST, wxEVT_RIGHT_UP,
137  wxMouseEventHandler(
139 
140  this->Connect( wxEVT_MENU, wxCommandEventHandler( DIALOG_DRC_CONTROL::OnPopupMenu ), NULL,
141  this );
142 
143 
144  m_DeleteCurrentMarkerButton->Enable( false );
145 
147 
148  // read options
149  bool value;
150  m_config->Read( TestMissingCourtyardKey, &value, false );
151  m_cbCourtyardMissing->SetValue( value );
152  m_config->Read( TestFootprintCourtyardKey, &value, false );
153  m_cbCourtyardOverlap->SetValue( value );
154  m_config->Read( RefillZonesBeforeDrc, &value, false );
155  m_cbRefillZones->SetValue( value );
156 
157  // Set the initial "enabled" status of the browse button and the text
158  // field for report name
159  wxCommandEvent junk;
160  OnReportCheckBoxClicked( junk );
161 
162  Layout(); // adding the units above expanded Clearance text, now resize.
163 
164  SetFocus();
165 }
166 
167 /* accept DRC parameters (min clearance value and min sizes
168 */
170 {
174 
176 }
177 
178 
179 void DIALOG_DRC_CONTROL::SetRptSettings( bool aEnable, const wxString& aFileName )
180 {
181  m_RptFilenameCtrl->Enable( aEnable );
182  m_BrowseButton->Enable( aEnable );
183  m_CreateRptCtrl->SetValue( aEnable );
184  m_RptFilenameCtrl->SetValue( aFileName );
185 }
186 
187 
188 void DIALOG_DRC_CONTROL::GetRptSettings( bool* aEnable, wxString& aFileName )
189 {
190  *aEnable = m_CreateRptCtrl->GetValue();
191  aFileName = m_RptFilenameCtrl->GetValue();
192 }
193 
194 
195 void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
196 {
197  wxString reportName;
198 
199  bool make_report = m_CreateRptCtrl->IsChecked();
200 
201  if( make_report ) // Create a rpt file
202  {
203  reportName = m_RptFilenameCtrl->GetValue();
204 
205  if( reportName.IsEmpty() )
206  {
207  wxCommandEvent dummy;
209  }
210 
211  if( !reportName.IsEmpty() )
212  reportName = makeValidFileNameReport();
213  }
214 
215  SetDrcParmeters();
216  m_tester->SetSettings( true, // Pad to pad DRC test enabled
217  true, // unconnected pads DRC test enabled
218  true, // DRC test for zones enabled
219  true, // DRC test for keepout areas enabled
220  m_cbRefillZones->GetValue(),
221  m_cbCourtyardOverlap->GetValue(),
222  m_cbCourtyardMissing->GetValue(),
223  m_cbReportAllTrackErrors->GetValue(),
224  reportName, make_report );
225 
226  DelDRCMarkers();
227 
228  wxBeginBusyCursor();
229 
230  // run all the tests, with no UI at this time.
231  m_Messages->Clear();
232  wxSafeYield(); // Allows time slice to refresh the m_Messages window
233  m_brdEditor->GetBoard()->m_Status_Pcb = 0; // Force full connectivity and ratsnest recalculations
235  m_Notebook->ChangeSelection( 0 ); // display the 1at tab "...Markers ..."
236 
237 
238  // Generate the report
239  if( !reportName.IsEmpty() )
240  {
241  if( writeReport( reportName ) )
242  {
243  wxString msg;
244  msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) );
245 
246  wxString caption( _( "Disk File Report Completed" ) );
247  wxMessageDialog popupWindow( this, msg, caption );
248  popupWindow.ShowModal();
249  }
250  else
251  DisplayError( this, wxString::Format( _( "Unable to create report file \"%s\""),
252  GetChars( reportName ) ) );
253  }
254 
255  wxEndBusyCursor();
256 
257  RedrawDrawPanel();
258 }
259 
260 
261 void DIALOG_DRC_CONTROL::OnDeleteAllClick( wxCommandEvent& event )
262 {
263  DelDRCMarkers();
264  RedrawDrawPanel();
266 }
267 
268 
269 void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
270 {
271  wxString reportName;
272 
273  bool make_report = m_CreateRptCtrl->IsChecked();
274 
275  if( make_report ) // Create a file rpt
276  {
277  reportName = m_RptFilenameCtrl->GetValue();
278 
279  if( reportName.IsEmpty() )
280  {
281  wxCommandEvent junk;
283  }
284 
285  if( !reportName.IsEmpty() )
286  reportName = makeValidFileNameReport();
287  }
288 
289  SetDrcParmeters();
290 
291  m_tester->SetSettings( true, // Pad to pad DRC test enabled
292  true, // unconnected pads DRC test enabled
293  true, // DRC test for zones enabled
294  true, // DRC test for keepout areas enabled
295  m_cbRefillZones->GetValue(),
296  m_cbCourtyardOverlap->GetValue(),
297  m_cbCourtyardMissing->GetValue(),
298  m_cbReportAllTrackErrors->GetValue(),
299  reportName, make_report );
300 
301  DelDRCMarkers();
302 
303  wxBeginBusyCursor();
304 
305  m_Messages->Clear();
307 
308  m_Notebook->ChangeSelection( 1 ); // display the 2nd tab "Unconnected..."
309 
310  // Generate the report
311  if( !reportName.IsEmpty() )
312  {
313  if( writeReport( reportName ) )
314  {
315  wxString msg;
316  msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) );
317  wxString caption( _( "Disk File Report Completed" ) );
318  wxMessageDialog popupWindow( this, msg, caption );
319  popupWindow.ShowModal();
320  }
321  else
322  DisplayError( this, wxString::Format( _( "Unable to create report file \"%s\""),
323  GetChars( reportName ) ) );
324  }
325 
327 
328  wxEndBusyCursor();
329 
330  /* there is currently nothing visible on the DrawPanel for unconnected pads
331  * RedrawDrawPanel();
332  */
333 }
334 
335 
337 {
338  wxFileName fn = m_brdEditor->GetBoard()->GetFileName();
339  fn.SetExt( ReportFileExtension );
340  wxString prj_path = Prj().GetProjectPath();
341 
342  wxFileDialog dlg( this, _( "Save DRC Report File" ), prj_path,
343  fn.GetFullName(), ReportFileWildcard(),
344  wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
345 
346  if( dlg.ShowModal() == wxID_CANCEL )
347  return;
348 
349  m_RptFilenameCtrl->SetValue( dlg.GetPath() );
350 }
351 
352 
353 void DIALOG_DRC_CONTROL::OnOkClick( wxCommandEvent& event )
354 {
355  SetReturnCode( wxID_OK );
356  SetDrcParmeters();
357 
358  // The dialog can be modal or not modal.
359  // Leave the DRC caller destroy (or not) the dialog
360  m_tester->DestroyDRCDialog( wxID_OK );
361 }
362 
363 
364 void DIALOG_DRC_CONTROL::OnCancelClick( wxCommandEvent& event )
365 {
366  SetReturnCode( wxID_CANCEL );
367 
368  // The dialog can be modal or not modal.
369  // Leave the DRC caller destroy (or not) the dialog
370  m_tester->DestroyDRCDialog( wxID_CANCEL );
371 }
372 
373 
374 void DIALOG_DRC_CONTROL::OnReportCheckBoxClicked( wxCommandEvent& event )
375 {
376  m_RptFilenameCtrl->Enable( m_CreateRptCtrl->IsChecked() );
377  m_BrowseButton->Enable( m_CreateRptCtrl->IsChecked() );
378 }
379 
380 
381 void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event )
382 {
383  event.Skip();
384 
385  // I am assuming that the double click actually changed the selected item.
386  // please verify this.
387  int selection = m_ClearanceListBox->GetSelection();
388 
389  if( selection != wxNOT_FOUND )
390  {
391  // Find the selected MARKER in the PCB, position cursor there.
392  // Then close the dialog.
393  const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );
394 
395  if( item )
396  {
397  auto pos = item->GetPointA();
398 
399  if( auto marker = item->GetParent() )
400  pos = marker->GetPos();
401 
402  // When selecting a item, center it on GAL and just move the graphic
403  // cursor in legacy mode gives the best result
404  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
405  m_brdEditor->FocusOnLocation( pos, true, center );
406 
407  if( !IsModal() )
408  {
409  // turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window,
410  // no destruction so we can preserve listbox cursor
411  Show( false );
412 
413  // We do not want the clarification popup window.
414  // when releasing the left button in the main window
416  }
417  }
418  }
419 }
420 
421 
422 void DIALOG_DRC_CONTROL::OnPopupMenu( wxCommandEvent& event )
423 {
424  int source = event.GetId();
425 
426  const DRC_ITEM* item = nullptr;
427  wxPoint pos;
428 
429  int selection;
430 
431  switch( source )
432  {
434  selection = m_UnconnectedListBox->GetSelection();
435  item = m_UnconnectedListBox->GetItem( selection );
436  pos = item->GetPointA();
437  break;
438 
440  selection = m_UnconnectedListBox->GetSelection();
441  item = m_UnconnectedListBox->GetItem( selection );
442  pos = item->GetPointB();
443  break;
444 
445  case ID_POPUP_MARKERS_A:
446  selection = m_ClearanceListBox->GetSelection();
447  item = m_ClearanceListBox->GetItem( selection );
448  pos = item->GetPointA();
449  break;
450 
451  case ID_POPUP_MARKERS_B:
452  selection = m_ClearanceListBox->GetSelection();
453  item = m_ClearanceListBox->GetItem( selection );
454  pos = item->GetPointB();
455  break;
456  }
457 
458  if( item )
459  {
460  // When selecting a item, center it on GAL and just move the graphic
461  // cursor in legacy mode gives the best result
462  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
463  m_brdEditor->FocusOnLocation( pos, true, center );
464 
465  if( !IsModal() )
466  Show( false );
467  }
468 }
469 
470 
471 void DIALOG_DRC_CONTROL::OnRightUpUnconnected( wxMouseEvent& event )
472 {
473  // popup menu to go to either of the items listed in the DRC_ITEM.
474 
475  int selection = m_UnconnectedListBox->GetSelection();
476 
477  if( selection != wxNOT_FOUND )
478  {
479  wxMenu menu;
480  wxMenuItem* mItem;
481  const DRC_ITEM* dItem = m_UnconnectedListBox->GetItem( selection );
482 
483  mItem = new wxMenuItem( &menu, ID_POPUP_UNCONNECTED_A, dItem->GetTextA() );
484  menu.Append( mItem );
485 
486  if( dItem->HasSecondItem() )
487  {
488  mItem = new wxMenuItem( &menu, ID_POPUP_UNCONNECTED_B, dItem->GetTextB() );
489  menu.Append( mItem );
490  }
491 
492  PopupMenu( &menu );
493  }
494 }
495 
496 
497 void DIALOG_DRC_CONTROL::OnRightUpClearance( wxMouseEvent& event )
498 {
499  // popup menu to go to either of the items listed in the DRC_ITEM.
500 
501  int selection = m_ClearanceListBox->GetSelection();
502 
503  if( selection != wxNOT_FOUND )
504  {
505  wxMenu menu;
506  wxMenuItem* mItem;
507  const DRC_ITEM* dItem = m_ClearanceListBox->GetItem( selection );
508 
509  mItem = new wxMenuItem( &menu, ID_POPUP_MARKERS_A, dItem->GetTextA() );
510  menu.Append( mItem );
511 
512  if( dItem->HasSecondItem() )
513  {
514  mItem = new wxMenuItem( &menu, ID_POPUP_MARKERS_B, dItem->GetTextB() );
515  menu.Append( mItem );
516  }
517 
518  PopupMenu( &menu );
519  }
520 }
521 
522 
524 {
525  event.Skip();
526 
527  // I am assuming that the double click actually changed the selected item.
528  // please verify this.
529  int selection = m_UnconnectedListBox->GetSelection();
530 
531  if( selection != wxNOT_FOUND )
532  {
533  // Find the selected DRC_ITEM in the listbox, position cursor there,
534  // at the first of the two pads.
535  // Then hide the dialog.
536  const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
537  if( item )
538  {
539  // When selecting a item, center it on GAL and just move the graphic
540  // cursor in legacy mode gives the best result
541  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
542  m_brdEditor->FocusOnLocation( item->GetPointA(), true, center );
543 
544  if( !IsModal() )
545  {
546  Show( false );
547 
548  // We do not want the clarification popup window.
549  // when releasing the left button in the main window
551  }
552  }
553  }
554 }
555 
556 
557 /* called when switching from Error list to Unconnected list
558  * To avoid mistakes, the current marker is selection is cleared
559  */
560 void DIALOG_DRC_CONTROL::OnChangingMarkerList( wxNotebookEvent& event )
561 {
562  // Shouldn't be necessary, but is on at least OSX
563  m_Notebook->ChangeSelection( event.GetSelection() );
564 
565  m_DeleteCurrentMarkerButton->Enable( false );
566  m_ClearanceListBox->SetSelection( -1 );
567  m_UnconnectedListBox->SetSelection( -1 );
568 }
569 
570 
571 void DIALOG_DRC_CONTROL::OnMarkerSelectionEvent( wxCommandEvent& event )
572 {
573  int selection = event.GetSelection();
574 
575  if( selection != wxNOT_FOUND )
576  {
577  // until a MARKER is selected, this button is not enabled.
578  m_DeleteCurrentMarkerButton->Enable( true );
579 
580  // Find the selected DRC_ITEM in the listbox, position cursor there,
581  // at the first of the two pads.
582  const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );
583  if( item )
584  {
585  auto pos = item->GetPointA();
586 
587  if( auto marker = item->GetParent() )
588  pos = marker->GetPos();
589 
590  // When selecting a item, center it on GAL and just move the graphic
591  // cursor in legacy mode gives the best result
592  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
593  m_brdEditor->FocusOnLocation( pos, false, center );
594  RedrawDrawPanel();
595  }
596  }
597 
598  event.Skip();
599 }
600 
601 
603 {
604  int selection = event.GetSelection();
605 
606  if( selection != wxNOT_FOUND )
607  {
608  // until a MARKER is selected, this button is not enabled.
609  m_DeleteCurrentMarkerButton->Enable( true );
610 
611  // Find the selected DRC_ITEM in the listbox, position cursor there,
612  // at the first of the two pads.
613  const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
614 
615  if( item )
616  {
617  // When selecting a item, center it on GAL and just move the graphic
618  // cursor in legacy mode gives the best result
619  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
620  m_brdEditor->FocusOnLocation( item->GetPointA(), false, center );
621  RedrawDrawPanel();
622  }
623  }
624 
625  event.Skip();
626 }
627 
628 
630 {
631  int freezeCount = 0;
632 
633  while( m_brdEditor->IsFrozen() )
634  {
635  m_brdEditor->Thaw();
636  freezeCount++;
637  }
638 
640 
641  while( freezeCount > 0 )
642  {
643  m_brdEditor->Freeze();
644  freezeCount--;
645  }
646 }
647 
648 
650 {
651  m_brdEditor->SetCurItem( NULL ); // clear curr item, because it could be a DRC marker
654  m_DeleteCurrentMarkerButton->Enable( false );
655 }
656 
657 
659 {
660  wxFileName fn = m_RptFilenameCtrl->GetValue();
661 
662  if( !fn.HasExt() )
663  {
664  fn.SetExt( ReportFileExtension );
665  m_RptFilenameCtrl->SetValue( fn.GetFullPath() );
666  }
667 
668  // Ensure it is an absolute filename. if it is given relative
669  // it will be made relative to the project
670  if( !fn.IsAbsolute() )
671  {
672  wxString prj_path = Prj().GetProjectPath();
673  fn.MakeAbsolute( prj_path );
674  }
675 
676  return fn.GetFullPath();
677 }
678 
679 
680 bool DIALOG_DRC_CONTROL::writeReport( const wxString& aFullFileName )
681 {
682  FILE* fp = wxFopen( aFullFileName, wxT( "w" ) );
683 
684  if( fp == NULL )
685  return false;
686 
687  int count;
688 
689  fprintf( fp, "** Drc report for %s **\n",
691 
692  wxDateTime now = wxDateTime::Now();
693 
694  fprintf( fp, "** Created on %s **\n", TO_UTF8( now.Format( wxT( "%F %T" ) ) ) );
695 
696  count = m_ClearanceListBox->GetItemCount();
697 
698  fprintf( fp, "\n** Found %d DRC errors **\n", count );
699 
700  for( int i = 0; i<count; ++i )
701  fprintf( fp, "%s", TO_UTF8( m_ClearanceListBox->GetItem( i )->ShowReport()) );
702 
703  count = m_UnconnectedListBox->GetItemCount();
704 
705  fprintf( fp, "\n** Found %d unconnected pads **\n", count );
706 
707  for( int i = 0; i<count; ++i )
708  fprintf( fp, "%s", TO_UTF8( m_UnconnectedListBox->GetItem( i )->ShowReport() ) );
709 
710  fprintf( fp, "\n** End of Report **\n" );
711 
712  fclose( fp );
713 
714  return true;
715 }
716 
717 
718 void DIALOG_DRC_CONTROL::OnDeleteOneClick( wxCommandEvent& event )
719 {
720  int selectedIndex;
721  int curTab = m_Notebook->GetSelection();
722 
723  if( curTab == 0 )
724  {
725  selectedIndex = m_ClearanceListBox->GetSelection();
726 
727  if( selectedIndex != wxNOT_FOUND )
728  {
729  m_ClearanceListBox->DeleteItem( selectedIndex );
730 
731  // redraw the pcb
732  RedrawDrawPanel();
733  }
734  }
735  else if( curTab == 1 )
736  {
737  selectedIndex = m_UnconnectedListBox->GetSelection();
738 
739  if( selectedIndex != wxNOT_FOUND )
740  {
741  m_UnconnectedListBox->DeleteItem( selectedIndex );
742 
743  /* these unconnected DRC_ITEMs are not currently visible on the pcb
744  * RedrawDrawPanel();
745  */
746  }
747  }
748 
750 }
751 
752 
754 {
755  int marker_count = m_ClearanceListBox->GetItemCount();
756  int unconnected_count = m_UnconnectedListBox->GetItemCount();
757 
758  m_MarkerCount->SetLabelText( wxString::Format( "%d", marker_count ) );
759  m_UnconnectedCount->SetLabelText( wxString::Format( "%d", unconnected_count ) );
760 }
void DeleteItem(int aIndex)
Function DeleteElement will delete one of the items in the list.
void DestroyDRCDialog(int aReason)
Deletes this ui dialog box and zeros out its pointer to remember the state of the dialog&#39;s existence...
Definition: drc.cpp:106
DIALOG_DRC_CONTROL(DRC *aTester, PCB_EDIT_FRAME *aEditorFrame, wxWindow *aParent)
Constructors.
Definition: dialog_drc.cpp:52
void UpdateDisplayedCounts()
Definition: dialog_drc.cpp:753
#define ID_CLEARANCE_LIST
Class DRC_ITEM is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item. ...
Definition: drc_item.h:45
void OnMarkerSelectionEvent(wxCommandEvent &event) override
Definition: dialog_drc.cpp:571
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
bool HasSecondItem() const
Definition: drc_item.h:140
MARKER_BASE * GetParent() const
Definition: drc_item.h:138
Implementation of conversion functions that require both schematic and board internal units...
This file is part of the common library.
void OnUnconnectedSelectionEvent(wxCommandEvent &event) override
Definition: dialog_drc.cpp:602
void OnRightUpClearance(wxMouseEvent &event) override
wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST
Definition: dialog_drc.cpp:497
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:351
void FocusOnLocation(const wxPoint &aPos, bool aWarpMouseCursor=true, bool aCenterView=false)
Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor...
void OnStartdrcClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_STARTDRC
Definition: dialog_drc.cpp:195
void GetRptSettings(bool *aEnable, wxString &aFileName)
Definition: dialog_drc.cpp:188
wxCheckBox * m_cbRefillZones
wxCheckBox * m_CreateRptCtrl
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
wxString ShowReport() const
Function ShowReport translates this object into a text string suitable for saving to disk in a report...
Definition: drc_item.h:210
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
wxTextCtrl * m_RptFilenameCtrl
void OnActivateDlg(wxActivateEvent &event) override
handler for activate event, updating data which can be modified outside the dialog (DRC parameters) ...
Definition: dialog_drc.cpp:91
const wxString makeValidFileNameReport()
filenames can be entered by name.
Definition: dialog_drc.cpp:658
wxStaticText * m_ViaMinUnit
void OnLeftDClickClearance(wxMouseEvent &event) override
wxEVT_LEFT_DCLICK event handler for ID_CLEARANCE_LIST
Definition: dialog_drc.cpp:381
const wxPoint & GetPointB() const
Definition: drc_item.h:267
BOARD * GetBoard() const
wxButton * m_DeleteCurrentMarkerButton
void ListUnconnectedPads()
Gather a list of all the unconnected pads and shows them in the dialog, and optionally prints a repor...
Definition: drc.cpp:487
void SkipNextLeftButtonReleaseEvent()
function SkipNextLeftButtonReleaseEvent after calling this function, if the left mouse button is down...
Definition: draw_frame.cpp:300
void OnDeleteAllClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ALL
Definition: dialog_drc.cpp:261
const wxString ReportFileExtension
DRCLISTBOX * m_UnconnectedListBox
void OnListUnconnectedClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIST_UNCONNECTED
Definition: dialog_drc.cpp:269
BOARD_DESIGN_SETTINGS m_BrdSettings
Definition: dialog_drc.h:56
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxTextCtrl * m_SetViaMinSizeCtrl
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
Class DIALOG_DRC_CONTROL_BASE.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void SetSettings(bool aPad2PadTest, bool aUnconnectedTest, bool aZonesTest, bool aKeepoutTest, bool aRefillZones, bool aCourtyardTest, bool aCourtyardMissingTest, bool aReportAllTrackErrors, const wxString &aReportName, bool aSaveReport)
Save all the UI or test settings and may be called before running the tests.
Definition: drc.h:509
wxStaticText * m_MicroViaMinUnit
#define ID_POPUP_MARKERS_A
void DeleteAllItems()
Function DeleteAllItems deletes all items in the list.
wxString ReportFileWildcard()
const wxString & GetFileName() const
Definition: class_board.h:234
DRCLISTBOX * m_ClearanceListBox
const DRC_ITEM * GetItem(int aIndex)
Function GetItem returns a requested DRC_ITEM* or NULL.
#define TestMissingCourtyardKey
Definition: dialog_drc.cpp:47
int m_TrackMinWidth
track min value for width ((min copper size value
void OnLeftDClickUnconnected(wxMouseEvent &event) override
wxEVT_LEFT_DCLICK event handler for ID_UNCONNECTED_LIST
Definition: dialog_drc.cpp:523
int m_ViasMinSize
vias (not micro vias) min diameter
wxString GetAbbreviatedUnitsLabel(EDA_UNITS_T aUnit)
Definition: base_units.cpp:485
wxCheckBox * m_cbCourtyardMissing
wxStaticText * m_UnconnectedCount
#define ID_POPUP_UNCONNECTED_B
The common library.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:532
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:887
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aDesignSettings)
Function SetDesignSettings.
Definition: class_board.h:542
wxConfigBase * m_config
Definition: dialog_drc.h:149
wxCheckBox * m_cbCourtyardOverlap
#define ID_POPUP_MARKERS_B
void OnReportCheckBoxClicked(wxCommandEvent &event) override
wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX
Definition: dialog_drc.cpp:374
#define ID_POPUP_UNCONNECTED_A
int m_MicroViasMinSize
micro vias (not vias) min diameter
int ValueFromTextCtrl(const wxTextCtrl &aTextCtr)
Convert the number Value in a string according to the internal units and the selected unit (g_UserUni...
Definition: base_units.cpp:386
void OnCancelClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
Definition: dialog_drc.cpp:364
bool Show(bool show) override
void OnButtonBrowseRptFileClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_BROWSE_RPT_FILE
Definition: dialog_drc.cpp:336
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:57
bool writeReport(const wxString &aFullFileName)
Function writeReport outputs the MARKER items and unconnecte DRC_ITEMs with commentary to an open tex...
Definition: dialog_drc.cpp:680
const wxString & GetTextA() const
Definition: drc_item.h:249
wxCheckBox * m_cbReportAllTrackErrors
void PutValueInLocalUnits(wxTextCtrl &aTextCtr, int aValue)
Function PutValueInLocalUnits converts aValue from internal units to user units and append the units ...
Definition: base_units.cpp:267
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void OnPopupMenu(wxCommandEvent &event)
Definition: dialog_drc.cpp:422
see class PGM_BASE
void OnDeleteOneClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE
Definition: dialog_drc.cpp:718
const wxPoint & GetPointA() const
Definition: drc_item.h:261
void OnOkClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
Definition: dialog_drc.cpp:353
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
Design Rule Checker object that performs all the DRC tests.
Definition: drc.h:162
wxStaticText * m_MarkerCount
size_t i
Definition: json11.cpp:597
wxTextCtrl * m_SetMicroViakMinSizeCtrl
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:100
wxStaticText * m_TrackMinWidthUnit
#define RefillZonesBeforeDrc
Definition: dialog_drc.cpp:49
void OnRightUpUnconnected(wxMouseEvent &event) override
wxEVT_RIGHT_UP event handler for ID_UNCONNECTED_LIST
Definition: dialog_drc.cpp:471
wxTextCtrl * m_SetTrackMinWidthCtrl
void OnChangingMarkerList(wxNotebookEvent &event) override
Definition: dialog_drc.cpp:560
const wxString & GetTextB() const
Definition: drc_item.h:255
void RunTests(wxTextCtrl *aMessages=NULL)
Run all the tests specified with a previous call to SetSettings()
Definition: drc.cpp:363
#define ID_UNCONNECTED_LIST
#define TestFootprintCourtyardKey
Definition: dialog_drc.cpp:48
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
PCB_EDIT_FRAME * m_brdEditor
Definition: dialog_drc.h:148
BOARD * m_currentBoard
Definition: dialog_drc.h:146
void SetRptSettings(bool aEnable, const wxString &aFileName)
Enable/disable the report file creation.
Definition: dialog_drc.cpp:179
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:237