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 #include <tool/tool_manager.h>
43 #include <tools/pcb_actions.h>
44 
45 /* class DIALOG_DRC_CONTROL: a dialog to set DRC parameters (clearance, min cooper size)
46  * and run DRC tests
47  */
48 
49 // Keywords for read and write config
50 #define TestMissingCourtyardKey wxT( "TestMissingCourtyard" )
51 #define TestFootprintCourtyardKey wxT( "TestFootprintCourtyard" )
52 #define RefillZonesBeforeDrc wxT( "RefillZonesBeforeDrc" )
53 
54 
56  wxWindow* aParent ) :
57  DIALOG_DRC_CONTROL_BASE( aParent )
58 {
60  m_tester = aTester;
61  m_brdEditor = aEditorFrame;
64 
65  InitValues();
66 
67  // Now all widgets have the size fixed, call FinishDialogSettings
69 }
70 
72 {
75  m_config->Write( RefillZonesBeforeDrc, m_cbRefillZones->GetValue() );
76 
77  // Disonnect events
78  m_ClearanceListBox->Disconnect( ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK,
79  wxMouseEventHandler(
81  m_ClearanceListBox->Disconnect( ID_CLEARANCE_LIST, wxEVT_RIGHT_UP,
82  wxMouseEventHandler(
84  m_UnconnectedListBox->Disconnect( ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK,
85  wxMouseEventHandler( DIALOG_DRC_CONTROL::
86  OnLeftDClickUnconnected ), NULL, this );
87  m_UnconnectedListBox->Disconnect( ID_UNCONNECTED_LIST, wxEVT_RIGHT_UP,
88  wxMouseEventHandler(
90 
91  this->Disconnect( wxEVT_MENU, wxCommandEventHandler( DIALOG_DRC_CONTROL::OnPopupMenu ), NULL, this );
92 }
93 
94 void DIALOG_DRC_CONTROL::OnActivateDlg( wxActivateEvent& event )
95 {
97  {
98  // If m_currentBoard is not the current parent board,
99  // (for instance because a new board was loaded),
100  // close the dialog, because many pointers are now invalid
101  // in lists
102  SetReturnCode( wxID_CANCEL );
103  Close();
104  m_tester->DestroyDRCDialog( wxID_CANCEL );
105  return;
106  }
107 
108  // updating data which can be modified outside the dialog (DRC parameters, units ...)
109  // because the dialog is not modal
112 }
113 
114 
116 {
120 
124 }
125 
126 
128 {
129  // Connect events and objects
130  m_ClearanceListBox->Connect( ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK,
131  wxMouseEventHandler(
133  m_ClearanceListBox->Connect( ID_CLEARANCE_LIST, wxEVT_RIGHT_UP,
134  wxMouseEventHandler(
136  m_UnconnectedListBox->Connect( ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK,
137  wxMouseEventHandler( DIALOG_DRC_CONTROL::
138  OnLeftDClickUnconnected ), NULL, this );
139  m_UnconnectedListBox->Connect( ID_UNCONNECTED_LIST, wxEVT_RIGHT_UP,
140  wxMouseEventHandler(
142 
143  this->Connect( wxEVT_MENU, wxCommandEventHandler( DIALOG_DRC_CONTROL::OnPopupMenu ), NULL,
144  this );
145 
146 
147  m_DeleteCurrentMarkerButton->Enable( false );
148 
150 
151  // read options
152  bool value;
153  m_config->Read( TestMissingCourtyardKey, &value, false );
154  m_cbCourtyardMissing->SetValue( value );
155  m_config->Read( TestFootprintCourtyardKey, &value, false );
156  m_cbCourtyardOverlap->SetValue( value );
157  m_config->Read( RefillZonesBeforeDrc, &value, false );
158  m_cbRefillZones->SetValue( value );
159 
160  // Set the initial "enabled" status of the browse button and the text
161  // field for report name
162  wxCommandEvent junk;
163  OnReportCheckBoxClicked( junk );
164 
165  Layout(); // adding the units above expanded Clearance text, now resize.
166 
167  SetFocus();
168 }
169 
170 /* accept DRC parameters (min clearance value and min sizes
171 */
173 {
177 
179 }
180 
181 
182 void DIALOG_DRC_CONTROL::SetRptSettings( bool aEnable, const wxString& aFileName )
183 {
184  m_RptFilenameCtrl->Enable( aEnable );
185  m_BrowseButton->Enable( aEnable );
186  m_CreateRptCtrl->SetValue( aEnable );
187  m_RptFilenameCtrl->SetValue( aFileName );
188 }
189 
190 
191 void DIALOG_DRC_CONTROL::GetRptSettings( bool* aEnable, wxString& aFileName )
192 {
193  *aEnable = m_CreateRptCtrl->GetValue();
194  aFileName = m_RptFilenameCtrl->GetValue();
195 }
196 
197 
198 void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
199 {
200  wxString reportName;
201 
202  bool make_report = m_CreateRptCtrl->IsChecked();
203 
204  if( make_report ) // Create a rpt file
205  {
206  reportName = m_RptFilenameCtrl->GetValue();
207 
208  if( reportName.IsEmpty() )
209  {
210  wxCommandEvent dummy;
212  }
213 
214  if( !reportName.IsEmpty() )
215  reportName = makeValidFileNameReport();
216  }
217 
218  SetDrcParmeters();
219  m_tester->SetSettings( true, // Pad to pad DRC test enabled
220  true, // unconnected pads DRC test enabled
221  true, // DRC test for zones enabled
222  true, // DRC test for keepout areas enabled
223  m_cbRefillZones->GetValue(),
224  m_cbCourtyardOverlap->GetValue(),
225  m_cbCourtyardMissing->GetValue(),
226  m_cbReportAllTrackErrors->GetValue(),
227  reportName, make_report );
228 
229  DelDRCMarkers();
230 
231  wxBeginBusyCursor();
232 
233  // run all the tests, with no UI at this time.
234  m_Messages->Clear();
235  wxSafeYield(); // Allows time slice to refresh the m_Messages window
236  m_brdEditor->GetBoard()->m_Status_Pcb = 0; // Force full connectivity and ratsnest recalculations
238  m_Notebook->ChangeSelection( 0 ); // display the 1at tab "...Markers ..."
239 
240 
241  // Generate the report
242  if( !reportName.IsEmpty() )
243  {
244  if( writeReport( reportName ) )
245  {
246  wxString msg;
247  msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) );
248 
249  wxString caption( _( "Disk File Report Completed" ) );
250  wxMessageDialog popupWindow( this, msg, caption );
251  popupWindow.ShowModal();
252  }
253  else
254  DisplayError( this, wxString::Format( _( "Unable to create report file \"%s\""),
255  GetChars( reportName ) ) );
256  }
257 
258  wxEndBusyCursor();
259 
260  RedrawDrawPanel();
261 }
262 
263 
264 void DIALOG_DRC_CONTROL::OnDeleteAllClick( wxCommandEvent& event )
265 {
266  DelDRCMarkers();
267  RedrawDrawPanel();
269 }
270 
271 
272 void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
273 {
274  wxString reportName;
275 
276  bool make_report = m_CreateRptCtrl->IsChecked();
277 
278  if( make_report ) // Create a file rpt
279  {
280  reportName = m_RptFilenameCtrl->GetValue();
281 
282  if( reportName.IsEmpty() )
283  {
284  wxCommandEvent junk;
286  }
287 
288  if( !reportName.IsEmpty() )
289  reportName = makeValidFileNameReport();
290  }
291 
292  SetDrcParmeters();
293 
294  m_tester->SetSettings( true, // Pad to pad DRC test enabled
295  true, // unconnected pads DRC test enabled
296  true, // DRC test for zones enabled
297  true, // DRC test for keepout areas enabled
298  m_cbRefillZones->GetValue(),
299  m_cbCourtyardOverlap->GetValue(),
300  m_cbCourtyardMissing->GetValue(),
301  m_cbReportAllTrackErrors->GetValue(),
302  reportName, make_report );
303 
304  DelDRCMarkers();
305 
306  wxBeginBusyCursor();
307 
308  m_Messages->Clear();
310 
311  m_Notebook->ChangeSelection( 1 ); // display the 2nd tab "Unconnected..."
312 
313  // Generate the report
314  if( !reportName.IsEmpty() )
315  {
316  if( writeReport( reportName ) )
317  {
318  wxString msg;
319  msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) );
320  wxString caption( _( "Disk File Report Completed" ) );
321  wxMessageDialog popupWindow( this, msg, caption );
322  popupWindow.ShowModal();
323  }
324  else
325  DisplayError( this, wxString::Format( _( "Unable to create report file \"%s\""),
326  GetChars( reportName ) ) );
327  }
328 
330 
331  wxEndBusyCursor();
332 
333  /* there is currently nothing visible on the DrawPanel for unconnected pads
334  * RedrawDrawPanel();
335  */
336 }
337 
338 
340 {
341  wxFileName fn = m_brdEditor->GetBoard()->GetFileName();
342  fn.SetExt( ReportFileExtension );
343  wxString prj_path = Prj().GetProjectPath();
344 
345  wxFileDialog dlg( this, _( "Save DRC Report File" ), prj_path,
346  fn.GetFullName(), ReportFileWildcard(),
347  wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
348 
349  if( dlg.ShowModal() == wxID_CANCEL )
350  return;
351 
352  m_RptFilenameCtrl->SetValue( dlg.GetPath() );
353 }
354 
355 
356 void DIALOG_DRC_CONTROL::OnOkClick( wxCommandEvent& event )
357 {
358  SetReturnCode( wxID_OK );
359  SetDrcParmeters();
360 
361  // The dialog can be modal or not modal.
362  // Leave the DRC caller destroy (or not) the dialog
363  m_tester->DestroyDRCDialog( wxID_OK );
364 }
365 
366 
367 void DIALOG_DRC_CONTROL::OnCancelClick( wxCommandEvent& event )
368 {
369  SetReturnCode( wxID_CANCEL );
370 
371  // The dialog can be modal or not modal.
372  // Leave the DRC caller destroy (or not) the dialog
373  m_tester->DestroyDRCDialog( wxID_CANCEL );
374 }
375 
376 
377 void DIALOG_DRC_CONTROL::OnReportCheckBoxClicked( wxCommandEvent& event )
378 {
379  m_RptFilenameCtrl->Enable( m_CreateRptCtrl->IsChecked() );
380  m_BrowseButton->Enable( m_CreateRptCtrl->IsChecked() );
381 }
382 
383 
384 void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event )
385 {
386  event.Skip();
387 
388  // I am assuming that the double click actually changed the selected item.
389  // please verify this.
390  int selection = m_ClearanceListBox->GetSelection();
391 
392  if( selection != wxNOT_FOUND )
393  {
394  // Find the selected MARKER in the PCB, position cursor there.
395  // Then close the dialog.
396  const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );
397 
398  if( item )
399  {
400  auto pos = item->GetPointA();
401 
402  if( auto marker = item->GetParent() )
403  pos = marker->GetPos();
404 
405  // When selecting a item, center it on GAL and just move the graphic
406  // cursor in legacy mode gives the best result
407  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
408  m_brdEditor->FocusOnLocation( pos, true, center );
409 
410  if( !IsModal() )
411  {
412  // turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window,
413  // no destruction so we can preserve listbox cursor
414  Show( false );
415 
416  // We do not want the clarification popup window.
417  // when releasing the left button in the main window
419  }
420  }
421  }
422 }
423 
424 
425 void DIALOG_DRC_CONTROL::OnPopupMenu( wxCommandEvent& event )
426 {
427  int source = event.GetId();
428 
429  const DRC_ITEM* item = nullptr;
430  wxPoint pos;
431 
432  int selection;
433 
434  switch( source )
435  {
437  selection = m_UnconnectedListBox->GetSelection();
438  item = m_UnconnectedListBox->GetItem( selection );
439  pos = item->GetPointA();
440  break;
441 
443  selection = m_UnconnectedListBox->GetSelection();
444  item = m_UnconnectedListBox->GetItem( selection );
445  pos = item->GetPointB();
446  break;
447 
448  case ID_POPUP_MARKERS_A:
449  selection = m_ClearanceListBox->GetSelection();
450  item = m_ClearanceListBox->GetItem( selection );
451  pos = item->GetPointA();
452  break;
453 
454  case ID_POPUP_MARKERS_B:
455  selection = m_ClearanceListBox->GetSelection();
456  item = m_ClearanceListBox->GetItem( selection );
457  pos = item->GetPointB();
458  break;
459  }
460 
461  if( item )
462  {
463  // When selecting a item, center it on GAL and just move the graphic
464  // cursor in legacy mode gives the best result
465  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
466  m_brdEditor->FocusOnLocation( pos, true, center );
467 
468  if( !IsModal() )
469  Show( false );
470  }
471 }
472 
473 
474 void DIALOG_DRC_CONTROL::OnRightUpUnconnected( wxMouseEvent& event )
475 {
476  // popup menu to go to either of the items listed in the DRC_ITEM.
477 
478  int selection = m_UnconnectedListBox->GetSelection();
479 
480  if( selection != wxNOT_FOUND )
481  {
482  wxMenu menu;
483  wxMenuItem* mItem;
484  const DRC_ITEM* dItem = m_UnconnectedListBox->GetItem( selection );
485 
486  mItem = new wxMenuItem( &menu, ID_POPUP_UNCONNECTED_A, dItem->GetTextA() );
487  menu.Append( mItem );
488 
489  if( dItem->HasSecondItem() )
490  {
491  mItem = new wxMenuItem( &menu, ID_POPUP_UNCONNECTED_B, dItem->GetTextB() );
492  menu.Append( mItem );
493  }
494 
495  PopupMenu( &menu );
496  }
497 }
498 
499 
500 void DIALOG_DRC_CONTROL::OnRightUpClearance( wxMouseEvent& event )
501 {
502  // popup menu to go to either of the items listed in the DRC_ITEM.
503 
504  int selection = m_ClearanceListBox->GetSelection();
505 
506  if( selection != wxNOT_FOUND )
507  {
508  wxMenu menu;
509  wxMenuItem* mItem;
510  const DRC_ITEM* dItem = m_ClearanceListBox->GetItem( selection );
511 
512  mItem = new wxMenuItem( &menu, ID_POPUP_MARKERS_A, dItem->GetTextA() );
513  menu.Append( mItem );
514 
515  if( dItem->HasSecondItem() )
516  {
517  mItem = new wxMenuItem( &menu, ID_POPUP_MARKERS_B, dItem->GetTextB() );
518  menu.Append( mItem );
519  }
520 
521  PopupMenu( &menu );
522  }
523 }
524 
525 
527 {
528  event.Skip();
529 
530  // I am assuming that the double click actually changed the selected item.
531  // please verify this.
532  int selection = m_UnconnectedListBox->GetSelection();
533 
534  if( selection != wxNOT_FOUND )
535  {
536  // Find the selected DRC_ITEM in the listbox, position cursor there,
537  // at the first of the two pads.
538  // Then hide the dialog.
539  const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
540  if( item )
541  {
542  // When selecting a item, center it on GAL and just move the graphic
543  // cursor in legacy mode gives the best result
544  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
545  m_brdEditor->FocusOnLocation( item->GetPointA(), true, center );
546 
547  if( !IsModal() )
548  {
549  Show( false );
550 
551  // We do not want the clarification popup window.
552  // when releasing the left button in the main window
554  }
555  }
556  }
557 }
558 
559 
560 /* called when switching from Error list to Unconnected list
561  * To avoid mistakes, the current marker is selection is cleared
562  */
563 void DIALOG_DRC_CONTROL::OnChangingMarkerList( wxNotebookEvent& event )
564 {
565  // Shouldn't be necessary, but is on at least OSX
566  m_Notebook->ChangeSelection( event.GetSelection() );
567 
568  m_DeleteCurrentMarkerButton->Enable( false );
569  m_ClearanceListBox->SetSelection( -1 );
570  m_UnconnectedListBox->SetSelection( -1 );
571 }
572 
573 
574 void DIALOG_DRC_CONTROL::OnMarkerSelectionEvent( wxCommandEvent& event )
575 {
576  int selection = event.GetSelection();
577 
578  if( selection != wxNOT_FOUND )
579  {
580  // until a MARKER is selected, this button is not enabled.
581  m_DeleteCurrentMarkerButton->Enable( true );
582 
583  // Find the selected DRC_ITEM in the listbox, position cursor there,
584  // at the first of the two pads.
585  const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );
586  if( item )
587  {
588  auto pos = item->GetPointA();
589 
590  if( auto marker = item->GetParent() )
591  pos = marker->GetPos();
592 
593  // When selecting a item, center it on GAL and just move the graphic
594  // cursor in legacy mode gives the best result
595  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
596  m_brdEditor->FocusOnLocation( pos, false, center );
597  RedrawDrawPanel();
598  }
599  }
600 
601  event.Skip();
602 }
603 
604 
606 {
607  int selection = event.GetSelection();
608 
609  if( selection != wxNOT_FOUND )
610  {
611  // until a MARKER is selected, this button is not enabled.
612  m_DeleteCurrentMarkerButton->Enable( true );
613 
614  // Find the selected DRC_ITEM in the listbox, position cursor there,
615  // at the first of the two pads.
616  const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
617 
618  if( item )
619  {
620  // When selecting a item, center it on GAL and just move the graphic
621  // cursor in legacy mode gives the best result
622  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
623  m_brdEditor->FocusOnLocation( item->GetPointA(), false, center );
624  RedrawDrawPanel();
625  }
626  }
627 
628  event.Skip();
629 }
630 
631 
633 {
634  int freezeCount = 0;
635 
636  while( m_brdEditor->IsFrozen() )
637  {
638  m_brdEditor->Thaw();
639  freezeCount++;
640  }
641 
643 
644  while( freezeCount > 0 )
645  {
646  m_brdEditor->Freeze();
647  freezeCount--;
648  }
649 }
650 
651 
653 {
654  m_brdEditor->SetCurItem( NULL ); // clear curr item, because it could be a DRC marker
655 
656  // Clear current selection list to avoid selection of deleted items
658 
661  m_DeleteCurrentMarkerButton->Enable( false );
662 }
663 
664 
666 {
667  wxFileName fn = m_RptFilenameCtrl->GetValue();
668 
669  if( !fn.HasExt() )
670  {
671  fn.SetExt( ReportFileExtension );
672  m_RptFilenameCtrl->SetValue( fn.GetFullPath() );
673  }
674 
675  // Ensure it is an absolute filename. if it is given relative
676  // it will be made relative to the project
677  if( !fn.IsAbsolute() )
678  {
679  wxString prj_path = Prj().GetProjectPath();
680  fn.MakeAbsolute( prj_path );
681  }
682 
683  return fn.GetFullPath();
684 }
685 
686 
687 bool DIALOG_DRC_CONTROL::writeReport( const wxString& aFullFileName )
688 {
689  FILE* fp = wxFopen( aFullFileName, wxT( "w" ) );
690 
691  if( fp == NULL )
692  return false;
693 
694  int count;
695 
696  fprintf( fp, "** Drc report for %s **\n",
698 
699  wxDateTime now = wxDateTime::Now();
700 
701  fprintf( fp, "** Created on %s **\n", TO_UTF8( now.Format( wxT( "%F %T" ) ) ) );
702 
703  count = m_ClearanceListBox->GetItemCount();
704 
705  fprintf( fp, "\n** Found %d DRC errors **\n", count );
706 
707  for( int i = 0; i<count; ++i )
708  fprintf( fp, "%s", TO_UTF8( m_ClearanceListBox->GetItem( i )->ShowReport()) );
709 
710  count = m_UnconnectedListBox->GetItemCount();
711 
712  fprintf( fp, "\n** Found %d unconnected pads **\n", count );
713 
714  for( int i = 0; i<count; ++i )
715  fprintf( fp, "%s", TO_UTF8( m_UnconnectedListBox->GetItem( i )->ShowReport() ) );
716 
717  fprintf( fp, "\n** End of Report **\n" );
718 
719  fclose( fp );
720 
721  return true;
722 }
723 
724 
725 void DIALOG_DRC_CONTROL::OnDeleteOneClick( wxCommandEvent& event )
726 {
727  int selectedIndex;
728  int curTab = m_Notebook->GetSelection();
729 
730  if( curTab == 0 )
731  {
732  selectedIndex = m_ClearanceListBox->GetSelection();
733 
734  if( selectedIndex != wxNOT_FOUND )
735  {
736  m_ClearanceListBox->DeleteItem( selectedIndex );
737 
738  // redraw the pcb
739  RedrawDrawPanel();
740  }
741  }
742  else if( curTab == 1 )
743  {
744  selectedIndex = m_UnconnectedListBox->GetSelection();
745 
746  if( selectedIndex != wxNOT_FOUND )
747  {
748  m_UnconnectedListBox->DeleteItem( selectedIndex );
749 
750  /* these unconnected DRC_ITEMs are not currently visible on the pcb
751  * RedrawDrawPanel();
752  */
753  }
754  }
755 
757 }
758 
759 
761 {
762  int marker_count = m_ClearanceListBox->GetItemCount();
763  int unconnected_count = m_UnconnectedListBox->GetItemCount();
764 
765  m_MarkerCount->SetLabelText( wxString::Format( "%d", marker_count ) );
766  m_UnconnectedCount->SetLabelText( wxString::Format( "%d", unconnected_count ) );
767 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
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:117
DIALOG_DRC_CONTROL(DRC *aTester, PCB_EDIT_FRAME *aEditorFrame, wxWindow *aParent)
Constructors.
Definition: dialog_drc.cpp:55
void UpdateDisplayedCounts()
Definition: dialog_drc.cpp:760
#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:574
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:338
bool HasSecondItem() const
Definition: drc_item.h:141
MARKER_BASE * GetParent() const
Definition: drc_item.h:139
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:605
void OnRightUpClearance(wxMouseEvent &event) override
wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST
Definition: dialog_drc.cpp:500
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:359
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:198
void GetRptSettings(bool *aEnable, wxString &aFileName)
Definition: dialog_drc.cpp:191
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:211
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:94
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
const wxString makeValidFileNameReport()
filenames can be entered by name.
Definition: dialog_drc.cpp:665
wxStaticText * m_ViaMinUnit
void OnLeftDClickClearance(wxMouseEvent &event) override
wxEVT_LEFT_DCLICK event handler for ID_CLEARANCE_LIST
Definition: dialog_drc.cpp:384
const wxPoint & GetPointB() const
Definition: drc_item.h:268
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:529
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:264
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:272
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:504
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:236
DRCLISTBOX * m_ClearanceListBox
const DRC_ITEM * GetItem(int aIndex)
Function GetItem returns a requested DRC_ITEM* or NULL.
#define TestMissingCourtyardKey
Definition: dialog_drc.cpp:50
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:526
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:535
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:895
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aDesignSettings)
Function SetDesignSettings.
Definition: class_board.h:545
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:377
#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:367
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:339
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:687
const wxString & GetTextA() const
Definition: drc_item.h:250
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
TOOL_MANAGER * GetToolManager() const
Function GetToolManager returns the tool manager instance, if any.
Definition: draw_frame.h:910
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:425
see class PGM_BASE
void OnDeleteOneClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE
Definition: dialog_drc.cpp:725
const wxPoint & GetPointA() const
Definition: drc_item.h:262
void OnOkClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
Definition: dialog_drc.cpp:356
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
Class PCB_EDIT_FRAME is the main frame for Pcbnew.
wxTextCtrl * m_SetMicroViakMinSizeCtrl
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:102
wxStaticText * m_TrackMinWidthUnit
#define RefillZonesBeforeDrc
Definition: dialog_drc.cpp:52
void OnRightUpUnconnected(wxMouseEvent &event) override
wxEVT_RIGHT_UP event handler for ID_UNCONNECTED_LIST
Definition: dialog_drc.cpp:474
wxTextCtrl * m_SetTrackMinWidthCtrl
void OnChangingMarkerList(wxNotebookEvent &event) override
Definition: dialog_drc.cpp:563
const wxString & GetTextB() const
Definition: drc_item.h:256
void RunTests(wxTextCtrl *aMessages=NULL)
Run all the tests specified with a previous call to SetSettings()
Definition: drc.cpp:401
#define ID_UNCONNECTED_LIST
#define TestFootprintCourtyardKey
Definition: dialog_drc.cpp:51
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:182
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:239