KiCad PCB EDA Suite
dialog_drc.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2009-2016 Dick Hollenbeck, dick@softplc.com
6  * Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #include <base_units.h>
27 #include <bitmaps.h>
28 #include <collectors.h>
29 #include <confirm.h>
30 #include <dialog_drc.h>
31 #include <fctsys.h>
32 #include <kiface_i.h>
33 #include <pcb_edit_frame.h>
34 #include <pgm_base.h>
35 #include <tool/tool_manager.h>
36 #include <tools/pcb_actions.h>
37 #include <view/view.h>
39 
40 /* class DIALOG_DRC_CONTROL: a dialog to set DRC parameters (clearance, min cooper size)
41  * and run DRC tests
42  */
43 
44 // Keywords for read and write config
45 #define DrcRefillZonesKey wxT( "RefillZonesBeforeDrc" )
46 #define DrcTrackToZoneTestKey wxT( "DrcTrackToZoneTest" )
47 #define DrcTestFootprintsKey wxT( "DrcTestFootprints" )
48 
49 
51  DRC* aTester, PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent )
52  : DIALOG_DRC_CONTROL_BASE( aParent ),
53  m_trackMinWidth( aEditorFrame, m_TrackMinWidthTitle, m_SetTrackMinWidthCtrl,
54  m_TrackMinWidthUnit, true ),
55  m_viaMinSize( aEditorFrame, m_ViaMinTitle, m_SetViaMinSizeCtrl, m_ViaMinUnit, true ),
56  m_uviaMinSize( aEditorFrame, m_MicroViaMinTitle, m_SetMicroViakMinSizeCtrl,
57  m_MicroViaMinUnit, true )
58 {
59  SetName( DIALOG_DRC_WINDOW_NAME ); // Set a window name to be able to find it
60 
62  m_tester = aTester;
63  m_brdEditor = aEditorFrame;
66 
67  m_BrowseButton->SetBitmap( KiBitmap( folder_xpm ) );
68 
69  // We use a sdbSizer here to get the order right, which is platform-dependent
70  m_sdbSizer1OK->SetLabel( _( "Run DRC" ) );
71  m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
72  m_sizerButtons->Layout();
73 
74  m_sdbSizer1OK->SetDefault();
75 
76  InitValues();
77 
79 }
80 
81 
83 {
84  m_config->Write( DrcRefillZonesKey, m_cbRefillZones->GetValue() );
86  m_config->Write( DrcTestFootprintsKey, m_cbTestFootprints->GetValue() );
87 }
88 
89 
90 void DIALOG_DRC_CONTROL::OnActivateDlg( wxActivateEvent& event )
91 {
93  {
94  // If m_currentBoard is not the current parent board,
95  // (for instance because a new board was loaded),
96  // close the dialog, because many pointers are now invalid
97  // in lists
98  SetReturnCode( wxID_CANCEL );
99  Close();
100  m_tester->DestroyDRCDialog( wxID_CANCEL );
101  return;
102  }
103 
104  // updating data which can be modified outside the dialog (DRC parameters, units ...)
105  // because the dialog is not modal
108 }
109 
110 
112 {
116 }
117 
118 
120 {
121  m_markersTitleTemplate = m_Notebook->GetPageText( 0 );
122  m_unconnectedTitleTemplate = m_Notebook->GetPageText( 1 );
123  m_footprintsTitleTemplate = m_Notebook->GetPageText( 2 );
124 
125  m_DeleteCurrentMarkerButton->Enable( false );
126 
128 
129  // read options
130  bool value;
131  m_config->Read( DrcRefillZonesKey, &value, false );
132  m_cbRefillZones->SetValue( value );
133  m_config->Read( DrcTrackToZoneTestKey, &value, false );
134  m_cbReportTracksToZonesErrors->SetValue( value );
135  m_config->Read( DrcTestFootprintsKey, &value, false );
136  m_cbTestFootprints->SetValue( value );
137 
138  Layout(); // adding the units above expanded Clearance text, now resize.
139 
140  SetFocus();
141 }
142 
143 
145 {
149 
151 }
152 
153 
154 void DIALOG_DRC_CONTROL::SetRptSettings( bool aEnable, const wxString& aFileName )
155 {
156  m_RptFilenameCtrl->SetValue( aFileName );
157  m_CreateRptCtrl->SetValue( aEnable );
158 }
159 
160 
161 void DIALOG_DRC_CONTROL::GetRptSettings( bool* aEnable, wxString& aFileName )
162 {
163  *aEnable = m_CreateRptCtrl->GetValue();
164  aFileName = m_RptFilenameCtrl->GetValue();
165 }
166 
167 
168 void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
169 {
170  wxString reportName, msg;
171 
172  bool make_report = m_CreateRptCtrl->IsChecked();
173 
174  if( make_report ) // Create a rpt file
175  {
176  reportName = m_RptFilenameCtrl->GetValue();
177 
178  if( reportName.IsEmpty() )
179  {
180  wxCommandEvent dummy;
182  }
183 
184  if( !reportName.IsEmpty() )
185  reportName = makeValidFileNameReport();
186  }
187 
190  m_tester->m_rptFilename = reportName;
191  m_tester->m_doCreateRptFile = make_report;
192  m_tester->m_refillZones = m_cbRefillZones->GetValue();
195 
196  DelDRCMarkers();
197 
198  wxBeginBusyCursor();
199  wxWindowDisabler disabler;
200 
201  // run all the tests, with no UI at this time.
202  m_Messages->Clear();
203  wxSafeYield(); // Allows time slice to refresh the Messages
205  m_Notebook->ChangeSelection( 0 ); // display the "Problems/Markers" tab
206 
207  // Generate the report
208  if( !reportName.IsEmpty() )
209  {
210  if( writeReport( reportName ) )
211  {
212  msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) );
213  wxMessageDialog popupWindow( this, msg, _( "Disk File Report Completed" ) );
214  popupWindow.ShowModal();
215  }
216  else
217  {
218  msg.Printf( _( "Unable to create report file \"%s\"" ), GetChars( reportName ) );
219  DisplayError( this, msg );
220  }
221  }
222 
223  wxEndBusyCursor();
224 
225  RedrawDrawPanel();
226 }
227 
228 
229 void DIALOG_DRC_CONTROL::OnDeleteAllClick( wxCommandEvent& event )
230 {
231  DelDRCMarkers();
232  RedrawDrawPanel();
234 }
235 
236 
238 {
239  wxFileName fn = m_brdEditor->GetBoard()->GetFileName();
240  fn.SetExt( ReportFileExtension );
241  wxString prj_path = Prj().GetProjectPath();
242 
243  wxFileDialog dlg( this, _( "Save DRC Report File" ), prj_path, fn.GetFullName(),
244  ReportFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
245 
246  if( dlg.ShowModal() == wxID_CANCEL )
247  return;
248 
249  m_CreateRptCtrl->SetValue( true );
250  m_RptFilenameCtrl->SetValue( dlg.GetPath() );
251 }
252 
253 
254 void DIALOG_DRC_CONTROL::OnCancelClick( wxCommandEvent& event )
255 {
256  SetReturnCode( wxID_CANCEL );
258 
259  // The dialog can be modal or not modal.
260  // Leave the DRC caller destroy (or not) the dialog
261  m_tester->DestroyDRCDialog( wxID_CANCEL );
262 }
263 
264 
265 void DIALOG_DRC_CONTROL::OnReportCheckBoxClicked( wxCommandEvent& event )
266 {
267  if( m_CreateRptCtrl->IsChecked() )
268  m_RptFilenameCtrl->SetFocus();
269 }
270 
271 
272 void DIALOG_DRC_CONTROL::OnReportFilenameEdited( wxCommandEvent& event )
273 {
274  m_CreateRptCtrl->SetValue( event.GetString().Length() );
275 }
276 
277 
278 void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event )
279 {
280  event.Skip();
281 
282  int selection = m_ClearanceListBox->GetSelection();
283 
284  if( selection != wxNOT_FOUND )
285  {
286  if( focusOnItem( m_ClearanceListBox->GetItem( selection ) ) )
287  {
288  // turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window,
289  // no destruction so we can preserve listbox cursor
290  if( !IsModal() )
291  Show( false );
292  }
293  }
294 }
295 
296 
297 void DIALOG_DRC_CONTROL::OnRightUpFootprints( wxMouseEvent& event )
298 {
299  int selection = rightUpClicSelection( m_FootprintsListBox, event );
300 
301  if( selection != wxNOT_FOUND )
303 }
304 
305 
306 void DIALOG_DRC_CONTROL::OnLeftUpClearance( wxMouseEvent& event )
307 {
308  int selection = m_ClearanceListBox->GetSelection();
309 
310  if( selection != wxNOT_FOUND )
311  focusOnItem( m_ClearanceListBox->GetItem( selection ) );
312 }
313 
314 
316 {
317  if( !aItem )
318  return false;
319 
320  auto toolmgr = m_brdEditor->GetToolManager();
321  auto pos = aItem->GetPointA();
322  auto marker = static_cast<MARKER_PCB*>( aItem->GetParent() );
323 
324  if( marker )
325  {
326  pos = marker->GetPos();
327 
328  toolmgr->RunAction( PCB_ACTIONS::selectionClear, true );
329  toolmgr->RunAction( PCB_ACTIONS::selectItem, true, marker );
330  }
331 
332  m_brdEditor->FocusOnLocation( pos, true );
334 
335  return true;
336 }
337 
338 
339 int DIALOG_DRC_CONTROL::rightUpClicSelection( DRCLISTBOX* aListBox, wxMouseEvent& event )
340 {
341 #if wxCHECK_VERSION( 3, 1, 3 )
342  // wxWidgets 3.1.3 has a bug in HitTest(): one cannot have the item selection
343  // on a right click: the returned value is always 10 so do not try to select
344  // an item on the right click. Just use the current selection (if any)
345  int selection = aListBox->GetSelection();
346 #else
347  // Check if user right-clicked on a different item, and select the right clicked item
348  int selection = aListBox->HitTest( event.GetPosition() );
349 
350  if( selection >= (int) aListBox->GetItemCount() ) // Should not happen.
351  selection = wxNOT_FOUND;
352 #endif
353  if( selection == wxNOT_FOUND )
354  selection = aListBox->GetSelection();
355  else if( aListBox->GetSelection() != selection )
356  aListBox->SetSelection( selection );
357 
358  return selection;
359 }
360 
361 
362 void DIALOG_DRC_CONTROL::OnRightUpUnconnected( wxMouseEvent& event )
363 {
364  // popup menu to go to either of the items listed in the DRC_ITEM.
365  int selection = rightUpClicSelection( m_UnconnectedListBox, event );
366 
367  if( selection != wxNOT_FOUND )
369 }
370 
371 
372 void DIALOG_DRC_CONTROL::OnRightUpClearance( wxMouseEvent& event )
373 {
374  // popup menu to go to either of the items listed in the DRC_ITEM.
375  int selection = rightUpClicSelection( m_ClearanceListBox, event );
376 
377  if( selection != wxNOT_FOUND )
378  doSelectionMenu( m_ClearanceListBox->GetItem( selection ) );
379 }
380 
381 
383 {
384  // popup menu to go to either of the items listed in the DRC_ITEM.
385 
386  BOARD_ITEM* first = aItem->GetMainItem( m_brdEditor->GetBoard() );
387  BOARD_ITEM* second = nullptr;
388 
389  GENERAL_COLLECTOR items;
390 
391  items.Append( first );
392 
393  if( aItem->HasSecondItem() )
394  {
395  second = aItem->GetAuxiliaryItem( m_brdEditor->GetBoard() );
396  items.Append( second );
397  }
398 
399  WINDOW_THAWER thawer( m_brdEditor );
402 
403  // If we got an item, focus on it
404  BOARD_ITEM* selection = items.GetCount() ? items[0] : nullptr;
405 
406  if( selection && ( selection == first || selection == second ) )
407  m_brdEditor->FocusOnLocation( selection->GetPosition(), true );
408 
410 }
411 
412 
414 {
415  event.Skip();
416 
417  int selection = m_FootprintsListBox->GetSelection();
418 
419  if( selection != wxNOT_FOUND )
420  {
421  // Find the selected DRC_ITEM in the listbox, position cursor there.
422  // Then hide the dialog.
423  if( focusOnItem( m_FootprintsListBox->GetItem( selection ) ) )
424  {
425  if( !IsModal() )
426  Show( false );
427  }
428  }
429 }
430 
431 
433 {
434  event.Skip();
435 
436  int selection = m_UnconnectedListBox->GetSelection();
437 
438  if( selection != wxNOT_FOUND )
439  {
440  if( focusOnItem( m_UnconnectedListBox->GetItem( selection ) ) )
441  {
442  // turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window,
443  // no destruction so we can preserve listbox cursor
444  if( !IsModal() )
445  Show( false );
446  }
447  }
448 }
449 
450 
451 void DIALOG_DRC_CONTROL::OnLeftUpUnconnected( wxMouseEvent& event )
452 {
453  int selection = m_UnconnectedListBox->GetSelection();
454 
455  if( selection != wxNOT_FOUND )
456  focusOnItem( m_UnconnectedListBox->GetItem( selection ) );
457 }
458 
459 
460 void DIALOG_DRC_CONTROL::OnChangingMarkerList( wxNotebookEvent& event )
461 {
462  // Shouldn't be necessary, but is on at least OSX
463  if( event.GetSelection() >= 0 )
464  m_Notebook->ChangeSelection( (unsigned) event.GetSelection() );
465 
466  m_DeleteCurrentMarkerButton->Enable( false );
467  m_ClearanceListBox->SetSelection( -1 );
468  m_UnconnectedListBox->SetSelection( -1 );
469 }
470 
471 
472 void DIALOG_DRC_CONTROL::OnMarkerSelectionEvent( wxCommandEvent& event )
473 {
474  int selection = event.GetSelection();
475 
476  if( selection != wxNOT_FOUND )
477  {
478  // until a MARKER is selected, this button is not enabled.
479  m_DeleteCurrentMarkerButton->Enable( true );
480 
481  // Find the selected DRC_ITEM in the listbox, position cursor there.
482  focusOnItem( m_ClearanceListBox->GetItem( selection ) );
483  }
484 
485  event.Skip();
486 }
487 
488 
490 {
491  int selection = event.GetSelection();
492 
493  if( selection != wxNOT_FOUND )
494  {
495  // until a MARKER is selected, this button is not enabled.
496  m_DeleteCurrentMarkerButton->Enable( true );
497 
498  // Find the selected DRC_ITEM in the listbox, position cursor there.
499  focusOnItem( m_UnconnectedListBox->GetItem( selection ) );
500  }
501 
502  event.Skip();
503 }
504 
505 
507 {
508  int selection = event.GetSelection();
509 
510  if( selection != wxNOT_FOUND )
511  {
512  // until a MARKER is selected, this button is not enabled.
513  m_DeleteCurrentMarkerButton->Enable( true );
514 
515  // Find the selected DRC_ITEM in the listbox, position cursor there.
516  focusOnItem( m_FootprintsListBox->GetItem( selection ) );
517  }
518 
519  event.Skip();
520 }
521 
522 
524 {
525  WINDOW_THAWER thawer( m_brdEditor );
526 
528 }
529 
530 
532 {
533  // Clear current selection list to avoid selection of deleted items
535 
538  m_DeleteCurrentMarkerButton->Enable( false );
539 }
540 
541 
543 {
544  wxFileName fn = m_RptFilenameCtrl->GetValue();
545 
546  if( !fn.HasExt() )
547  {
548  fn.SetExt( ReportFileExtension );
549  m_RptFilenameCtrl->SetValue( fn.GetFullPath() );
550  }
551 
552  // Ensure it is an absolute filename. if it is given relative
553  // it will be made relative to the project
554  if( !fn.IsAbsolute() )
555  {
556  wxString prj_path = Prj().GetProjectPath();
557  fn.MakeAbsolute( prj_path );
558  }
559 
560  return fn.GetFullPath();
561 }
562 
563 
564 bool DIALOG_DRC_CONTROL::writeReport( const wxString& aFullFileName )
565 {
566  FILE* fp = wxFopen( aFullFileName, wxT( "w" ) );
567 
568  if( fp == NULL )
569  return false;
570 
571  int count;
572  EDA_UNITS units = GetUserUnits();
573 
574  fprintf( fp, "** Drc report for %s **\n", TO_UTF8( m_brdEditor->GetBoard()->GetFileName() ) );
575 
576  wxDateTime now = wxDateTime::Now();
577 
578  fprintf( fp, "** Created on %s **\n", TO_UTF8( now.Format( wxT( "%F %T" ) ) ) );
579 
580  count = m_ClearanceListBox->GetItemCount();
581 
582  fprintf( fp, "\n** Found %d DRC errors **\n", count );
583 
584  for( int i = 0; i < count; ++i )
585  fprintf( fp, "%s", TO_UTF8( m_ClearanceListBox->GetItem( i )->ShowReport( units ) ) );
586 
587  count = m_UnconnectedListBox->GetItemCount();
588 
589  fprintf( fp, "\n** Found %d unconnected pads **\n", count );
590 
591  for( int i = 0; i < count; ++i )
592  fprintf( fp, "%s", TO_UTF8( m_UnconnectedListBox->GetItem( i )->ShowReport( units ) ) );
593 
594  count = m_FootprintsListBox->GetItemCount();
595 
596  fprintf( fp, "\n** Found %d Footprint errors **\n", count );
597 
598  for( int i = 0; i < count; ++i )
599  fprintf( fp, "%s", TO_UTF8( m_FootprintsListBox->GetItem( i )->ShowReport( units ) ) );
600 
601 
602  fprintf( fp, "\n** End of Report **\n" );
603 
604  fclose( fp );
605 
606  return true;
607 }
608 
609 
610 void DIALOG_DRC_CONTROL::OnDeleteOneClick( wxCommandEvent& event )
611 {
612  ssize_t selectedIndex;
613  int curTab = m_Notebook->GetSelection();
614 
615  if( curTab == 0 )
616  {
617  selectedIndex = m_ClearanceListBox->GetSelection();
618 
619  if( selectedIndex != wxNOT_FOUND )
620  {
621  // Clear the selection. It may be the selected DRC marker.
623 
624  ssize_t newIndex = wxNOT_FOUND;
625 
626  if( m_ClearanceListBox->GetItemCount() > 1 )
627  {
628  newIndex = std::min( selectedIndex,
629  static_cast<ssize_t>( m_ClearanceListBox->GetItemCount() - 2 ) );
630  }
631 
632  m_ClearanceListBox->DeleteItem( selectedIndex );
633 
634  if( newIndex != wxNOT_FOUND )
635  {
636  focusOnItem( m_ClearanceListBox->GetItem( newIndex ) );
637  m_ClearanceListBox->SetSelection( newIndex );
638  }
639 
640  // redraw the pcb
641  RedrawDrawPanel();
642  }
643  }
644  else if( curTab == 1 )
645  {
646  selectedIndex = m_UnconnectedListBox->GetSelection();
647 
648  if( selectedIndex != wxNOT_FOUND )
649  {
650  m_UnconnectedListBox->DeleteItem( selectedIndex );
651 
652  /* these unconnected DRC_ITEMs are not currently visible on the pcb
653  * RedrawDrawPanel();
654  */
655  }
656  }
657 
659 }
660 
661 
663 {
664  wxString msg;
665 
666  if( m_tester->m_drcRun )
667  {
668  msg.sprintf( m_markersTitleTemplate, (int) m_ClearanceListBox->GetItemCount() );
669  m_Notebook->SetPageText( 0, msg );
670 
671  msg.sprintf( m_unconnectedTitleTemplate, (int) m_UnconnectedListBox->GetItemCount() );
672  m_Notebook->SetPageText( 1, msg );
673 
675  msg.sprintf( m_footprintsTitleTemplate, (int) m_FootprintsListBox->GetItemCount() );
676  else
677  {
679  msg.Replace( wxT( "%d" ), _( "not run" ) );
680  }
681  m_Notebook->SetPageText( 2, msg );
682  }
683  else
684  {
686  msg.Replace( wxT( "(%d)" ), wxEmptyString );
687  m_Notebook->SetPageText( 0, msg );
688 
690  msg.Replace( wxT( "(%d)" ), wxEmptyString );
691  m_Notebook->SetPageText( 1, msg );
692 
694  msg.Replace( wxT( "(%d)" ), wxEmptyString );
695  m_Notebook->SetPageText( 2, msg );
696  }
697 }
bool m_refillZones
Definition: drc.h:205
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:73
EDA_UNITS
Definition: common.h:72
void DeleteItem(int aIndex)
Function DeleteElement will delete one of the items in the list.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:236
bool m_doCreateRptFile
Definition: drc.h:204
const BITMAP_OPAQUE folder_xpm[1]
Definition: folder.cpp:20
void DestroyDRCDialog(int aReason)
Deletes this ui dialog box and zeros out its pointer to remember the state of the dialog's existence.
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
DIALOG_DRC_CONTROL(DRC *aTester, PCB_EDIT_FRAME *aEditorFrame, wxWindow *aParent)
Constructors.
Definition: dialog_drc.cpp:50
void OnLeftUpClearance(wxMouseEvent &event) override
wxEVT_LEFT_UP event handler for ID_CLEARANCE_LIST
Definition: dialog_drc.cpp:306
void UpdateDisplayedCounts()
Definition: dialog_drc.cpp:662
void OnLeftUpUnconnected(wxMouseEvent &event) override
wxEVT_LEFT_UP event handler for ID_UNCONNECTED_LIST
Definition: dialog_drc.cpp:451
DRC_ITEM is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item.
Definition: drc_item.h:48
void OnMarkerSelectionEvent(wxCommandEvent &event) override
Definition: dialog_drc.cpp:472
Implementation of conversion functions that require both schematic and board internal units.
This file is part of the common library.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
void OnUnconnectedSelectionEvent(wxCommandEvent &event) override
Definition: dialog_drc.cpp:489
void OnRightUpClearance(wxMouseEvent &event) override
wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST
Definition: dialog_drc.cpp:372
wxCheckBox * m_cbTestFootprints
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
BOARD_ITEM * GetAuxiliaryItem(BOARD *aBoard) const
Definition: drc_item.cpp:258
void OnStartdrcClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_STARTDRC
Definition: dialog_drc.cpp:168
void GetRptSettings(bool *aEnable, wxString &aFileName)
Definition: dialog_drc.cpp:161
wxCheckBox * m_cbRefillZones
wxCheckBox * m_CreateRptCtrl
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
void OnRightUpFootprints(wxMouseEvent &event) override
wxEVT_RIGHT_UP event handler for ID_FOOTPRINTS_LIST
Definition: dialog_drc.cpp:297
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:90
wxCheckBox * m_cbReportTracksToZonesErrors
MARKER_BASE * GetParent() const
Definition: drc_item.h:165
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
static TOOL_ACTION selectionMenu
Runs a selection menu to select from a list of items.
Definition: pcb_actions.h:84
const wxString makeValidFileNameReport()
filenames can be entered by name.
Definition: dialog_drc.cpp:542
void OnLeftDClickClearance(wxMouseEvent &event) override
wxEVT_LEFT_DCLICK event handler for ID_CLEARANCE_LIST
Definition: dialog_drc.cpp:278
wxButton * m_DeleteCurrentMarkerButton
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:530
UNIT_BINDER m_viaMinSize
Definition: dialog_drc.h:172
void OnDeleteAllClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ALL
Definition: dialog_drc.cpp:229
const wxString & GetFileName() const
Definition: class_board.h:215
DRCLISTBOX * m_UnconnectedListBox
void OnLeftDClickFootprints(wxMouseEvent &event) override
wxEVT_LEFT_DCLICK event handler for ID_FOOTPRINTS_LIST
Definition: dialog_drc.cpp:413
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:102
void OnFootprintsSelectionEvent(wxCommandEvent &event) override
Definition: dialog_drc.cpp:506
BOARD_DESIGN_SETTINGS m_BrdSettings
Definition: dialog_drc.h:54
#define DrcTestFootprintsKey
Definition: dialog_drc.cpp:47
void Append(EDA_ITEM *item)
Function Append adds an item to the end of the list.
Definition: collector.h:135
EDA_UNITS GetUserUnits() const
Definition: dialog_shim.h:132
wxString m_unconnectedTitleTemplate
Definition: dialog_drc.h:168
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:48
Class DIALOG_DRC_CONTROL_BASE.
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:116
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
bool m_testFootprints
Definition: drc.h:207
wxString m_footprintsTitleTemplate
Definition: dialog_drc.h:169
bool m_doZonesTest
Definition: drc.h:202
wxString m_markersTitleTemplate
Definition: dialog_drc.h:167
#define NULL
void DeleteAllItems()
Function DeleteAllItems deletes all items in the list.
wxString ReportFileWildcard()
DRCLISTBOX * m_ClearanceListBox
const DRC_ITEM * GetItem(int aIndex)
Function GetItem returns a requested DRC_ITEM* or NULL.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
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:432
int m_ViasMinSize
vias (not micro vias) min diameter
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
bool focusOnItem(const DRC_ITEM *aItem)
Definition: dialog_drc.cpp:315
Definition of file extensions used in Kicad.
int rightUpClicSelection(DRCLISTBOX *aListBox, wxMouseEvent &event)
Definition: dialog_drc.cpp:339
#define DIALOG_DRC_WINDOW_NAME
Definition: dialog_drc.h:49
wxBitmapButton * m_BrowseButton
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aDesignSettings)
Function SetDesignSettings.
Definition: class_board.h:540
bool m_reportAllTrackErrors
Definition: drc.h:206
wxConfigBase * m_config
Definition: dialog_drc.h:165
bool m_drcRun
Definition: drc.h:244
void OnReportCheckBoxClicked(wxCommandEvent &event) override
wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_RPT_FILE
Definition: dialog_drc.cpp:265
int m_MicroViasMinSize
micro vias (not vias) min diameter
BOARD_ITEM * GetMainItem(BOARD *aBoard) const
Access to A and B items for BOARDs.
Definition: drc_item.cpp:252
UNIT_BINDER m_uviaMinSize
Definition: dialog_drc.h:173
void OnCancelClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
Definition: dialog_drc.cpp:254
const wxPoint & GetPointA() const
Definition: drc_item.h:226
bool Show(bool show) override
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
#define DrcRefillZonesKey
Definition: dialog_drc.cpp:45
#define DrcTrackToZoneTestKey
Definition: dialog_drc.cpp:46
UNIT_BINDER m_trackMinWidth
Definition: dialog_drc.h:171
virtual const wxPoint GetPosition() const =0
bool m_footprintsTested
Definition: drc.h:245
void OnButtonBrowseRptFileClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_BROWSE_RPT_FILE
Definition: dialog_drc.cpp:237
bool HasSecondItem() const
Definition: drc_item.h:167
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:564
wxCheckBox * m_cbReportAllTrackErrors
DRCLISTBOX is used to display a DRC_ITEM_LIST.
void FocusOnLocation(const wxPoint &aPos, bool aCenterView=false)
Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor...
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:101
see class PGM_BASE
void OnDeleteOneClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE
Definition: dialog_drc.cpp:610
wxString m_rptFilename
Definition: drc.h:209
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
const std::string ReportFileExtension
#define _(s)
Definition: 3d_actions.cpp:31
Design Rule Checker object that performs all the DRC tests.
Definition: drc.h:186
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:240
void doSelectionMenu(const DRC_ITEM *aItem)
Run the SELECTION_TOOL's disambiguation menu to highlight the two BOARD_ITEMs in the DRC_ITEM.
Definition: dialog_drc.cpp:382
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
static TOOL_ACTION selectItem
Selects an item (specified as the event parameter).
Definition: pcb_actions.h:76
DRCLISTBOX * m_FootprintsListBox
void VetoContextMenuMouseWarp()
Disables mouse warping after the current context menu is closed.
Definition: tool_manager.h:384
PCB_EDIT_FRAME is the main frame for Pcbnew.
virtual long long int GetValue()
Function GetValue Returns the current value in Internal Units.
void OnRightUpUnconnected(wxMouseEvent &event) override
wxEVT_RIGHT_UP event handler for ID_UNCONNECTED_LIST
Definition: dialog_drc.cpp:362
BOARD * GetBoard() const
void OnChangingMarkerList(wxNotebookEvent &event) override
Definition: dialog_drc.cpp:460
void OnReportFilenameEdited(wxCommandEvent &event) override
wxEVT_COMMAND_TEXT_UPDATED event handler for m_RptFilenameCtrl
Definition: dialog_drc.cpp:272
void RunTests(wxTextCtrl *aMessages=NULL)
Run all the tests specified with a previous call to SetSettings()
PCB_EDIT_FRAME * m_brdEditor
Definition: dialog_drc.h:164
BOARD * m_currentBoard
Definition: dialog_drc.h:162
wxString ShowReport(EDA_UNITS aUnits) const
Function ShowReport translates this object into a text string suitable for saving to disk in a report...
void SetRptSettings(bool aEnable, const wxString &aFileName)
Enable/disable the report file creation.
Definition: dialog_drc.cpp:154