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  reportName, make_report );
224 
225  DelDRCMarkers();
226 
227  wxBeginBusyCursor();
228 
229  // run all the tests, with no UI at this time.
230  m_Messages->Clear();
231  wxSafeYield(); // Allows time slice to refresh the m_Messages window
232  m_brdEditor->GetBoard()->m_Status_Pcb = 0; // Force full connectivity and ratsnest recalculations
234  m_Notebook->ChangeSelection( 0 ); // display the 1at tab "...Markers ..."
235 
236 
237  // Generate the report
238  if( !reportName.IsEmpty() )
239  {
240  if( writeReport( reportName ) )
241  {
242  wxString msg;
243  msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) );
244 
245  wxString caption( _( "Disk File Report Completed" ) );
246  wxMessageDialog popupWindow( this, msg, caption );
247  popupWindow.ShowModal();
248  }
249  else
250  DisplayError( this, wxString::Format( _( "Unable to create report file \"%s\""),
251  GetChars( reportName ) ) );
252  }
253 
254  wxEndBusyCursor();
255 
256  RedrawDrawPanel();
257 }
258 
259 
260 void DIALOG_DRC_CONTROL::OnDeleteAllClick( wxCommandEvent& event )
261 {
262  DelDRCMarkers();
263  RedrawDrawPanel();
265 }
266 
267 
268 void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
269 {
270  wxString reportName;
271 
272  bool make_report = m_CreateRptCtrl->IsChecked();
273 
274  if( make_report ) // Create a file rpt
275  {
276  reportName = m_RptFilenameCtrl->GetValue();
277 
278  if( reportName.IsEmpty() )
279  {
280  wxCommandEvent junk;
282  }
283 
284  if( !reportName.IsEmpty() )
285  reportName = makeValidFileNameReport();
286  }
287 
288  SetDrcParmeters();
289 
290  m_tester->SetSettings( true, // Pad to pad DRC test enabled
291  true, // unconnected pads DRC test enabled
292  true, // DRC test for zones enabled
293  true, // DRC test for keepout areas enabled
294  m_cbRefillZones->GetValue(),
295  m_cbCourtyardOverlap->GetValue(),
296  m_cbCourtyardMissing->GetValue(),
297  reportName, make_report );
298 
299  DelDRCMarkers();
300 
301  wxBeginBusyCursor();
302 
303  m_Messages->Clear();
305 
306  m_Notebook->ChangeSelection( 1 ); // display the 2nd tab "Unconnected..."
307 
308  // Generate the report
309  if( !reportName.IsEmpty() )
310  {
311  if( writeReport( reportName ) )
312  {
313  wxString msg;
314  msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) );
315  wxString caption( _( "Disk File Report Completed" ) );
316  wxMessageDialog popupWindow( this, msg, caption );
317  popupWindow.ShowModal();
318  }
319  else
320  DisplayError( this, wxString::Format( _( "Unable to create report file \"%s\""),
321  GetChars( reportName ) ) );
322  }
323 
325 
326  wxEndBusyCursor();
327 
328  /* there is currently nothing visible on the DrawPanel for unconnected pads
329  * RedrawDrawPanel();
330  */
331 }
332 
333 
335 {
336  wxFileName fn = m_brdEditor->GetBoard()->GetFileName();
337  fn.SetExt( ReportFileExtension );
338  wxString prj_path = Prj().GetProjectPath();
339 
340  wxFileDialog dlg( this, _( "Save DRC Report File" ), prj_path,
341  fn.GetFullName(), ReportFileWildcard(),
342  wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
343 
344  if( dlg.ShowModal() == wxID_CANCEL )
345  return;
346 
347  m_RptFilenameCtrl->SetValue( dlg.GetPath() );
348 }
349 
350 
351 void DIALOG_DRC_CONTROL::OnOkClick( wxCommandEvent& event )
352 {
353  SetReturnCode( wxID_OK );
354  SetDrcParmeters();
355 
356  // The dialog can be modal or not modal.
357  // Leave the DRC caller destroy (or not) the dialog
358  m_tester->DestroyDRCDialog( wxID_OK );
359 }
360 
361 
362 void DIALOG_DRC_CONTROL::OnCancelClick( wxCommandEvent& event )
363 {
364  SetReturnCode( wxID_CANCEL );
365 
366  // The dialog can be modal or not modal.
367  // Leave the DRC caller destroy (or not) the dialog
368  m_tester->DestroyDRCDialog( wxID_CANCEL );
369 }
370 
371 
372 void DIALOG_DRC_CONTROL::OnReportCheckBoxClicked( wxCommandEvent& event )
373 {
374  m_RptFilenameCtrl->Enable( m_CreateRptCtrl->IsChecked() );
375  m_BrowseButton->Enable( m_CreateRptCtrl->IsChecked() );
376 }
377 
378 
379 void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event )
380 {
381  event.Skip();
382 
383  // I am assuming that the double click actually changed the selected item.
384  // please verify this.
385  int selection = m_ClearanceListBox->GetSelection();
386 
387  if( selection != wxNOT_FOUND )
388  {
389  // Find the selected MARKER in the PCB, position cursor there.
390  // Then close the dialog.
391  const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );
392 
393  if( item )
394  {
395  // When selecting a item, center it on GAL and just move the graphic
396  // cursor in legacy mode gives the best result
397  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
398  m_brdEditor->FocusOnLocation( item->GetPointA(), true, center );
399 
400  if( !IsModal() )
401  {
402  // turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window,
403  // no destruction so we can preserve listbox cursor
404  Show( false );
405 
406  // We do not want the clarification popup window.
407  // when releasing the left button in the main window
409  }
410  }
411  }
412 }
413 
414 
415 void DIALOG_DRC_CONTROL::OnPopupMenu( wxCommandEvent& event )
416 {
417  int source = event.GetId();
418 
419  const DRC_ITEM* item = nullptr;
420  wxPoint pos;
421 
422  int selection;
423 
424  switch( source )
425  {
427  selection = m_UnconnectedListBox->GetSelection();
428  item = m_UnconnectedListBox->GetItem( selection );
429  pos = item->GetPointA();
430  break;
431 
433  selection = m_UnconnectedListBox->GetSelection();
434  item = m_UnconnectedListBox->GetItem( selection );
435  pos = item->GetPointB();
436  break;
437 
438  case ID_POPUP_MARKERS_A:
439  selection = m_ClearanceListBox->GetSelection();
440  item = m_ClearanceListBox->GetItem( selection );
441  pos = item->GetPointA();
442  break;
443 
444  case ID_POPUP_MARKERS_B:
445  selection = m_ClearanceListBox->GetSelection();
446  item = m_ClearanceListBox->GetItem( selection );
447  pos = item->GetPointB();
448  break;
449  }
450 
451  if( item )
452  {
453  // When selecting a item, center it on GAL and just move the graphic
454  // cursor in legacy mode gives the best result
455  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
456  m_brdEditor->FocusOnLocation( pos, true, center );
457 
458  if( !IsModal() )
459  Show( false );
460  }
461 }
462 
463 
464 void DIALOG_DRC_CONTROL::OnRightUpUnconnected( wxMouseEvent& event )
465 {
466  // popup menu to go to either of the items listed in the DRC_ITEM.
467 
468  int selection = m_UnconnectedListBox->GetSelection();
469 
470  if( selection != wxNOT_FOUND )
471  {
472  wxMenu menu;
473  wxMenuItem* mItem;
474  const DRC_ITEM* dItem = m_UnconnectedListBox->GetItem( selection );
475 
476  mItem = new wxMenuItem( &menu, ID_POPUP_UNCONNECTED_A, dItem->GetTextA() );
477  menu.Append( mItem );
478 
479  if( dItem->HasSecondItem() )
480  {
481  mItem = new wxMenuItem( &menu, ID_POPUP_UNCONNECTED_B, dItem->GetTextB() );
482  menu.Append( mItem );
483  }
484 
485  PopupMenu( &menu );
486  }
487 }
488 
489 
490 void DIALOG_DRC_CONTROL::OnRightUpClearance( wxMouseEvent& event )
491 {
492  // popup menu to go to either of the items listed in the DRC_ITEM.
493 
494  int selection = m_ClearanceListBox->GetSelection();
495 
496  if( selection != wxNOT_FOUND )
497  {
498  wxMenu menu;
499  wxMenuItem* mItem;
500  const DRC_ITEM* dItem = m_ClearanceListBox->GetItem( selection );
501 
502  mItem = new wxMenuItem( &menu, ID_POPUP_MARKERS_A, dItem->GetTextA() );
503  menu.Append( mItem );
504 
505  if( dItem->HasSecondItem() )
506  {
507  mItem = new wxMenuItem( &menu, ID_POPUP_MARKERS_B, dItem->GetTextB() );
508  menu.Append( mItem );
509  }
510 
511  PopupMenu( &menu );
512  }
513 }
514 
515 
517 {
518  event.Skip();
519 
520  // I am assuming that the double click actually changed the selected item.
521  // please verify this.
522  int selection = m_UnconnectedListBox->GetSelection();
523 
524  if( selection != wxNOT_FOUND )
525  {
526  // Find the selected DRC_ITEM in the listbox, position cursor there,
527  // at the first of the two pads.
528  // Then hide the dialog.
529  const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
530  if( item )
531  {
532  // When selecting a item, center it on GAL and just move the graphic
533  // cursor in legacy mode gives the best result
534  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
535  m_brdEditor->FocusOnLocation( item->GetPointA(), true, center );
536 
537  if( !IsModal() )
538  {
539  Show( false );
540 
541  // We do not want the clarification popup window.
542  // when releasing the left button in the main window
544  }
545  }
546  }
547 }
548 
549 
550 /* called when switching from Error list to Unconnected list
551  * To avoid mistakes, the current marker is selection is cleared
552  */
553 void DIALOG_DRC_CONTROL::OnChangingMarkerList( wxNotebookEvent& event )
554 {
555  // Shouldn't be necessary, but is on at least OSX
556  m_Notebook->ChangeSelection( event.GetSelection() );
557 
558  m_DeleteCurrentMarkerButton->Enable( false );
559  m_ClearanceListBox->SetSelection( -1 );
560  m_UnconnectedListBox->SetSelection( -1 );
561 }
562 
563 
564 void DIALOG_DRC_CONTROL::OnMarkerSelectionEvent( wxCommandEvent& event )
565 {
566  int selection = event.GetSelection();
567 
568  if( selection != wxNOT_FOUND )
569  {
570  // until a MARKER is selected, this button is not enabled.
571  m_DeleteCurrentMarkerButton->Enable( true );
572 
573  // Find the selected DRC_ITEM in the listbox, position cursor there,
574  // at the first of the two pads.
575  const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );
576  if( item )
577  {
578  // When selecting a item, center it on GAL and just move the graphic
579  // cursor in legacy mode gives the best result
580  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
581  m_brdEditor->FocusOnLocation( item->GetPointA(), false, center );
582  RedrawDrawPanel();
583  }
584  }
585 
586  event.Skip();
587 }
588 
589 
591 {
592  int selection = event.GetSelection();
593 
594  if( selection != wxNOT_FOUND )
595  {
596  // until a MARKER is selected, this button is not enabled.
597  m_DeleteCurrentMarkerButton->Enable( true );
598 
599  // Find the selected DRC_ITEM in the listbox, position cursor there,
600  // at the first of the two pads.
601  const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
602 
603  if( item )
604  {
605  // When selecting a item, center it on GAL and just move the graphic
606  // cursor in legacy mode gives the best result
607  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
608  m_brdEditor->FocusOnLocation( item->GetPointA(), false, center );
609  RedrawDrawPanel();
610  }
611  }
612 
613  event.Skip();
614 }
615 
616 
618 {
619  int freezeCount = 0;
620 
621  while( m_brdEditor->IsFrozen() )
622  {
623  m_brdEditor->Thaw();
624  freezeCount++;
625  }
626 
628 
629  while( freezeCount > 0 )
630  {
631  m_brdEditor->Freeze();
632  freezeCount--;
633  }
634 }
635 
636 
638 {
639  m_brdEditor->SetCurItem( NULL ); // clear curr item, because it could be a DRC marker
642  m_DeleteCurrentMarkerButton->Enable( false );
643 }
644 
645 
647 {
648  wxFileName fn = m_RptFilenameCtrl->GetValue();
649 
650  if( !fn.HasExt() )
651  {
652  fn.SetExt( ReportFileExtension );
653  m_RptFilenameCtrl->SetValue( fn.GetFullPath() );
654  }
655 
656  // Ensure it is an absolute filename. if it is given relative
657  // it will be made relative to the project
658  if( !fn.IsAbsolute() )
659  {
660  wxString prj_path = Prj().GetProjectPath();
661  fn.MakeAbsolute( prj_path );
662  }
663 
664  return fn.GetFullPath();
665 }
666 
667 
668 bool DIALOG_DRC_CONTROL::writeReport( const wxString& aFullFileName )
669 {
670  FILE* fp = wxFopen( aFullFileName, wxT( "w" ) );
671 
672  if( fp == NULL )
673  return false;
674 
675  int count;
676 
677  fprintf( fp, "** Drc report for %s **\n",
679 
680  wxDateTime now = wxDateTime::Now();
681 
682  fprintf( fp, "** Created on %s **\n", TO_UTF8( now.Format( wxT( "%F %T" ) ) ) );
683 
684  count = m_ClearanceListBox->GetItemCount();
685 
686  fprintf( fp, "\n** Found %d DRC errors **\n", count );
687 
688  for( int i = 0; i<count; ++i )
689  fprintf( fp, "%s", TO_UTF8( m_ClearanceListBox->GetItem( i )->ShowReport()) );
690 
691  count = m_UnconnectedListBox->GetItemCount();
692 
693  fprintf( fp, "\n** Found %d unconnected pads **\n", count );
694 
695  for( int i = 0; i<count; ++i )
696  fprintf( fp, "%s", TO_UTF8( m_UnconnectedListBox->GetItem( i )->ShowReport() ) );
697 
698  fprintf( fp, "\n** End of Report **\n" );
699 
700  fclose( fp );
701 
702  return true;
703 }
704 
705 
706 void DIALOG_DRC_CONTROL::OnDeleteOneClick( wxCommandEvent& event )
707 {
708  int selectedIndex;
709  int curTab = m_Notebook->GetSelection();
710 
711  if( curTab == 0 )
712  {
713  selectedIndex = m_ClearanceListBox->GetSelection();
714 
715  if( selectedIndex != wxNOT_FOUND )
716  {
717  m_ClearanceListBox->DeleteItem( selectedIndex );
718 
719  // redraw the pcb
720  RedrawDrawPanel();
721  }
722  }
723  else if( curTab == 1 )
724  {
725  selectedIndex = m_UnconnectedListBox->GetSelection();
726 
727  if( selectedIndex != wxNOT_FOUND )
728  {
729  m_UnconnectedListBox->DeleteItem( selectedIndex );
730 
731  /* these unconnected DRC_ITEMs are not currently visible on the pcb
732  * RedrawDrawPanel();
733  */
734  }
735  }
736 
738 }
739 
740 
742 {
743  int marker_count = m_ClearanceListBox->GetItemCount();
744  int unconnected_count = m_UnconnectedListBox->GetItemCount();
745 
746  m_MarkerCount->SetLabelText( wxString::Format( "%d", marker_count ) );
747  m_UnconnectedCount->SetLabelText( wxString::Format( "%d", unconnected_count ) );
748 }
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:102
DIALOG_DRC_CONTROL(DRC *aTester, PCB_EDIT_FRAME *aEditorFrame, wxWindow *aParent)
Constructors.
Definition: dialog_drc.cpp:52
void UpdateDisplayedCounts()
Definition: dialog_drc.cpp:741
#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:43
void OnMarkerSelectionEvent(wxCommandEvent &event) override
Definition: dialog_drc.cpp:564
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:339
bool HasSecondItem() const
Definition: drc_item.h:131
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:590
void OnRightUpClearance(wxMouseEvent &event) override
wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST
Definition: dialog_drc.cpp:490
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:342
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:201
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:646
wxStaticText * m_ViaMinUnit
void OnLeftDClickClearance(wxMouseEvent &event) override
wxEVT_LEFT_DCLICK event handler for ID_CLEARANCE_LIST
Definition: dialog_drc.cpp:379
const wxPoint & GetPointB() const
Definition: drc_item.h:258
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:485
void SkipNextLeftButtonReleaseEvent()
function SkipNextLeftButtonReleaseEvent after calling this function, if the left mouse button is down...
Definition: draw_frame.cpp:289
void OnDeleteAllClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ALL
Definition: dialog_drc.cpp:260
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:268
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.
wxStaticText * m_MicroViaMinUnit
#define ID_POPUP_MARKERS_A
void SetSettings(bool aPad2PadTest, bool aUnconnectedTest, bool aZonesTest, bool aKeepoutTest, bool aRefillZones, bool aCourtyardTest, bool aCourtyardMissingTest, const wxString &aReportName, bool aSaveReport)
Save all the UI or test settings and may be called before running the tests.
Definition: drc.h:507
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:516
int m_ViasMinSize
vias (not micro vias) min diameter
wxString GetAbbreviatedUnitsLabel(EDA_UNITS_T aUnit)
Definition: base_units.cpp:484
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:874
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:372
#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:385
void OnCancelClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
Definition: dialog_drc.cpp:362
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:334
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
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:668
const wxString & GetTextA() const
Definition: drc_item.h:240
void PutValueInLocalUnits(wxTextCtrl &aTextCtr, int aValue)
Function PutValueInLocalUnits converts aValue from internal units to user units and append the units ...
Definition: base_units.cpp:266
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:415
see class PGM_BASE
void OnDeleteOneClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE
Definition: dialog_drc.cpp:706
const wxPoint & GetPointA() const
Definition: drc_item.h:252
void OnOkClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
Definition: dialog_drc.cpp:351
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
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:464
wxTextCtrl * m_SetTrackMinWidthCtrl
void OnChangingMarkerList(wxNotebookEvent &event) override
Definition: dialog_drc.cpp:553
const wxString & GetTextB() const
Definition: drc_item.h:246
void RunTests(wxTextCtrl *aMessages=NULL)
Run all the tests specified with a previous call to SetSettings()
Definition: drc.cpp:358
#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:74
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