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 <bitmaps.h>
35 #include <pgm_base.h>
36 #include <dialog_drc.h>
37 #include <pcb_edit_frame.h>
38 #include <base_units.h>
39 #include <board_design_settings.h>
40 #include <class_draw_panel_gal.h>
41 #include <view/view.h>
42 #include <collectors.h>
43 #include <tool/tool_manager.h>
44 #include <tools/pcb_actions.h>
45 
46 #include <tool/tool_manager.h>
47 #include <tools/pcb_actions.h>
48 
49 /* class DIALOG_DRC_CONTROL: a dialog to set DRC parameters (clearance, min cooper size)
50  * and run DRC tests
51  */
52 
53 // Keywords for read and write config
54 #define RefillZonesBeforeDrc wxT( "RefillZonesBeforeDrc" )
55 
56 
58 {
59  BOARD_THAWER( PCB_EDIT_FRAME* aBoardEditor )
60  {
61  m_boardEditor = aBoardEditor;
62  m_freezeCount = 0;
63 
64  while( m_boardEditor->IsFrozen() )
65  {
66  m_boardEditor->Thaw();
67  m_freezeCount++;
68  }
69  }
70 
72  {
73  while( m_freezeCount > 0 )
74  {
75  m_boardEditor->Freeze();
76  m_freezeCount--;
77  }
78  }
79 
80 protected:
83 };
84 
85 
87  wxWindow* aParent ) :
88  DIALOG_DRC_CONTROL_BASE( aParent ),
89  m_trackMinWidth( aEditorFrame, m_TrackMinWidthTitle, m_SetTrackMinWidthCtrl, m_TrackMinWidthUnit, true ),
90  m_viaMinSize( aEditorFrame, m_ViaMinTitle, m_SetViaMinSizeCtrl, m_ViaMinUnit, true ),
91  m_uviaMinSize( aEditorFrame, m_MicroViaMinTitle, m_SetMicroViakMinSizeCtrl, m_MicroViaMinUnit, true )
92 {
94  m_tester = aTester;
95  m_brdEditor = aEditorFrame;
98 
99  wxFont messagesLabelFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
100  messagesLabelFont.SetSymbolicSize( wxFONTSIZE_SMALL );
101  m_messagesLabel->SetFont( messagesLabelFont );
102 
103  m_BrowseButton->SetBitmap( KiBitmap( folder_xpm ) );
104 
105  // We use a sdbSizer here to get the order right, which is platform-dependent
106  m_sdbSizer1OK->SetLabel( _( "Run DRC" ) );
107  m_sdbSizer1Apply->SetLabel( _( "List Unconnected" ) );
108  m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
109  m_sizerButtons->Layout();
110 
111  m_sdbSizer1OK->SetDefault();
112 
113  InitValues();
114 
115  // Connect events
116  m_ClearanceListBox->Connect( ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK,
117  wxMouseEventHandler( DIALOG_DRC_CONTROL::OnLeftDClickClearance ), NULL, this );
118  m_ClearanceListBox->Connect( ID_CLEARANCE_LIST, wxEVT_RIGHT_UP,
119  wxMouseEventHandler( DIALOG_DRC_CONTROL::OnRightUpClearance ), NULL, this );
120  m_UnconnectedListBox->Connect( ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK,
121  wxMouseEventHandler( DIALOG_DRC_CONTROL::OnLeftDClickUnconnected ), NULL, this );
122  m_UnconnectedListBox->Connect( ID_UNCONNECTED_LIST, wxEVT_RIGHT_UP,
123  wxMouseEventHandler( DIALOG_DRC_CONTROL::OnRightUpUnconnected ), NULL, this );
124 
125  // Now all widgets have the size fixed, call FinishDialogSettings
127 }
128 
129 
131 {
132  m_config->Write( RefillZonesBeforeDrc, m_cbRefillZones->GetValue() );
133 
134  // Disconnect events
135  m_ClearanceListBox->Disconnect( ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK,
136  wxMouseEventHandler( DIALOG_DRC_CONTROL::OnLeftDClickClearance ), NULL, this );
137  m_ClearanceListBox->Disconnect( ID_CLEARANCE_LIST, wxEVT_RIGHT_UP,
138  wxMouseEventHandler( DIALOG_DRC_CONTROL::OnRightUpClearance ), NULL, this );
139  m_UnconnectedListBox->Disconnect( ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK,
140  wxMouseEventHandler( DIALOG_DRC_CONTROL::OnLeftDClickUnconnected ), NULL, this );
141  m_UnconnectedListBox->Disconnect( ID_UNCONNECTED_LIST, wxEVT_RIGHT_UP,
142  wxMouseEventHandler( DIALOG_DRC_CONTROL::OnRightUpUnconnected ), NULL, this );
143 }
144 
145 
146 void DIALOG_DRC_CONTROL::OnActivateDlg( wxActivateEvent& event )
147 {
149  {
150  // If m_currentBoard is not the current parent board,
151  // (for instance because a new board was loaded),
152  // close the dialog, because many pointers are now invalid
153  // in lists
154  SetReturnCode( wxID_CANCEL );
155  Close();
156  m_tester->DestroyDRCDialog( wxID_CANCEL );
157  return;
158  }
159 
160  // updating data which can be modified outside the dialog (DRC parameters, units ...)
161  // because the dialog is not modal
164 }
165 
166 
168 {
172 }
173 
174 
176 {
177  m_markersTitleTemplate = m_Notebook->GetPageText( 0 );
178  m_unconnectedTitleTemplate = m_Notebook->GetPageText( 1 );
179 
180  m_DeleteCurrentMarkerButton->Enable( false );
181 
183 
184  // read options
185  bool value;
186  m_config->Read( RefillZonesBeforeDrc, &value, false );
187  m_cbRefillZones->SetValue( value );
188 
189  Layout(); // adding the units above expanded Clearance text, now resize.
190 
191  SetFocus();
192 }
193 
194 /* accept DRC parameters (min clearance value and min sizes
195 */
197 {
201 
203 }
204 
205 
206 void DIALOG_DRC_CONTROL::SetRptSettings( bool aEnable, const wxString& aFileName )
207 {
208  m_RptFilenameCtrl->SetValue( aFileName );
209  m_CreateRptCtrl->SetValue( aEnable );
210 }
211 
212 
213 void DIALOG_DRC_CONTROL::GetRptSettings( bool* aEnable, wxString& aFileName )
214 {
215  *aEnable = m_CreateRptCtrl->GetValue();
216  aFileName = m_RptFilenameCtrl->GetValue();
217 }
218 
219 
220 void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
221 {
222  wxString reportName, msg;
223 
224  bool make_report = m_CreateRptCtrl->IsChecked();
225 
226  if( make_report ) // Create a rpt file
227  {
228  reportName = m_RptFilenameCtrl->GetValue();
229 
230  if( reportName.IsEmpty() )
231  {
232  wxCommandEvent dummy;
234  }
235 
236  if( !reportName.IsEmpty() )
237  reportName = makeValidFileNameReport();
238  }
239 
240  SetDrcParmeters();
241  m_tester->SetSettings( true, // Pad to pad DRC test enabled
242  true, // unconnected pads DRC test enabled
243  true, // DRC test for zones enabled
244  true, // DRC test for keepout areas enabled
245  m_cbRefillZones->GetValue(),
246  m_cbReportAllTrackErrors->GetValue(),
247  reportName, make_report );
248 
249  DelDRCMarkers();
250 
251  wxBeginBusyCursor();
252  wxWindowDisabler disabler;
253 
254  // run all the tests, with no UI at this time.
255  m_Messages->Clear();
256  wxSafeYield(); // Allows time slice to refresh the Messages
257  m_brdEditor->GetBoard()->m_Status_Pcb = 0; // Force full connectivity and ratsnest calculations
259  m_Notebook->ChangeSelection( 0 ); // display the "Problems/Markers" tab
260 
261  // Generate the report
262  if( !reportName.IsEmpty() )
263  {
264  if( writeReport( reportName ) )
265  {
266  msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) );
267  wxMessageDialog popupWindow( this, msg, _( "Disk File Report Completed" ) );
268  popupWindow.ShowModal();
269  }
270  else
271  {
272  msg.Printf( _( "Unable to create report file \"%s\"" ), GetChars( reportName ) );
273  DisplayError( this, msg );
274  }
275  }
276 
277  wxEndBusyCursor();
278 
279  RedrawDrawPanel();
280 }
281 
282 
283 void DIALOG_DRC_CONTROL::OnDeleteAllClick( wxCommandEvent& event )
284 {
285  DelDRCMarkers();
286  RedrawDrawPanel();
288 }
289 
290 
291 void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
292 {
293  wxString reportName, msg;
294 
295  bool make_report = m_CreateRptCtrl->IsChecked();
296 
297  if( make_report ) // Create a file rpt
298  {
299  reportName = m_RptFilenameCtrl->GetValue();
300 
301  if( reportName.IsEmpty() )
302  {
303  wxCommandEvent junk;
305  }
306 
307  if( !reportName.IsEmpty() )
308  reportName = makeValidFileNameReport();
309  }
310 
311  SetDrcParmeters();
312 
313  m_tester->SetSettings( true, // Pad to pad DRC test enabled
314  true, // unconnected pads DRC test enabled
315  true, // DRC test for zones enabled
316  true, // DRC test for keepout areas enabled
317  m_cbRefillZones->GetValue(),
318  m_cbReportAllTrackErrors->GetValue(),
319  reportName, make_report );
320 
321  DelDRCMarkers();
322 
323  wxBeginBusyCursor();
324 
325  m_Messages->Clear();
327 
328  m_Notebook->ChangeSelection( 1 ); // display the "Unconnected" tab
329 
330  // Generate the report
331  if( !reportName.IsEmpty() )
332  {
333  if( writeReport( reportName ) )
334  {
335  msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) );
336  wxMessageDialog popupWindow( this, msg, _( "Disk File Report Completed" ) );
337  popupWindow.ShowModal();
338  }
339  else
340  {
341  msg.Printf( _( "Unable to create report file \"%s\"" ), GetChars( reportName ) );
342  DisplayError( this, msg );
343  }
344  }
345 
347 
348  wxEndBusyCursor();
349 
350  /* there is currently nothing visible on the DrawPanel for unconnected pads
351  * RedrawDrawPanel();
352  */
353 }
354 
355 
357 {
358  wxFileName fn = m_brdEditor->GetBoard()->GetFileName();
359  fn.SetExt( ReportFileExtension );
360  wxString prj_path = Prj().GetProjectPath();
361 
362  wxFileDialog dlg( this, _( "Save DRC Report File" ), prj_path, fn.GetFullName(),
363  ReportFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
364 
365  if( dlg.ShowModal() == wxID_CANCEL )
366  return;
367 
368  m_CreateRptCtrl->SetValue( true );
369  m_RptFilenameCtrl->SetValue( dlg.GetPath() );
370 }
371 
372 
373 void DIALOG_DRC_CONTROL::OnCancelClick( wxCommandEvent& event )
374 {
375  SetReturnCode( wxID_CANCEL );
376  SetDrcParmeters();
377 
378  // The dialog can be modal or not modal.
379  // Leave the DRC caller destroy (or not) the dialog
380  m_tester->DestroyDRCDialog( wxID_CANCEL );
381 }
382 
383 
384 void DIALOG_DRC_CONTROL::OnReportCheckBoxClicked( wxCommandEvent& event )
385 {
386  if( m_CreateRptCtrl->IsChecked() )
387  m_RptFilenameCtrl->SetFocus();
388 }
389 
390 
391 void DIALOG_DRC_CONTROL::OnReportFilenameEdited( wxCommandEvent &event )
392 {
393  m_CreateRptCtrl->SetValue( event.GetString().Length() );
394 }
395 
396 
397 void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event )
398 {
399  event.Skip();
400 
401  int selection = m_ClearanceListBox->GetSelection();
402 
403  if( selection != wxNOT_FOUND )
404  {
405  // Find the selected MARKER in the PCB, position cursor there.
406  // Then close the dialog.
407  const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );
408 
409  if( item )
410  {
411  auto pos = item->GetPointA();
412 
413  if( auto marker = item->GetParent() )
414  pos = marker->GetPos();
415 
416  // When selecting a item, center it on GAL and just move the graphic
417  // cursor in legacy mode gives the best result
418  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
419  m_brdEditor->FocusOnLocation( pos, true, center );
420 
421  if( !IsModal() )
422  {
423  // turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window,
424  // no destruction so we can preserve listbox cursor
425  Show( false );
426 
427  // We do not want the clarify selection popup when releasing the
428  // left button in the main window
430  }
431  }
432  }
433 }
434 
435 
436 void DIALOG_DRC_CONTROL::OnRightUpUnconnected( wxMouseEvent& event )
437 {
438  // popup menu to go to either of the items listed in the DRC_ITEM.
439 
440  int selection = m_UnconnectedListBox->GetSelection();
441 
442  if( selection != wxNOT_FOUND )
444 }
445 
446 
447 void DIALOG_DRC_CONTROL::OnRightUpClearance( wxMouseEvent& event )
448 {
449  // popup menu to go to either of the items listed in the DRC_ITEM.
450 
451  int selection = m_ClearanceListBox->GetSelection();
452 
453  if( selection != wxNOT_FOUND )
454  doSelectionMenu( m_ClearanceListBox->GetItem( selection ) );
455 }
456 
457 
459 {
460  // popup menu to go to either of the items listed in the DRC_ITEM.
461  GENERAL_COLLECTOR items;
462 
463  items.Append( aItem->GetMainItem( m_brdEditor->GetBoard() ) );
464 
465  if( aItem->HasSecondItem() )
466  items.Append( aItem->GetAuxiliaryItem( m_brdEditor->GetBoard() ) );
467 
468  BOARD_THAWER thawer( m_brdEditor );
471 }
472 
473 
475 {
476  event.Skip();
477 
478  int selection = m_UnconnectedListBox->GetSelection();
479 
480  if( selection != wxNOT_FOUND )
481  {
482  // Find the selected DRC_ITEM in the listbox, position cursor there.
483  // Then hide the dialog.
484  const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
485  if( item )
486  {
487  // When selecting a item, center it on GAL and just move the graphic
488  // cursor in legacy mode gives the best result
489  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
490  m_brdEditor->FocusOnLocation( item->GetPointA(), true, center );
491 
492  if( !IsModal() )
493  {
494  Show( false );
495 
496  // We do not want the clarify selection popup when releasing the
497  // left button in the main window
499  }
500  }
501  }
502 }
503 
504 
505 /* called when switching from Error list to Unconnected list
506  * To avoid mistakes, the current marker is selection is cleared
507  */
508 void DIALOG_DRC_CONTROL::OnChangingMarkerList( wxNotebookEvent& event )
509 {
510  // Shouldn't be necessary, but is on at least OSX
511  m_Notebook->ChangeSelection( event.GetSelection() );
512 
513  m_DeleteCurrentMarkerButton->Enable( false );
514  m_ClearanceListBox->SetSelection( -1 );
515  m_UnconnectedListBox->SetSelection( -1 );
516 }
517 
518 
519 void DIALOG_DRC_CONTROL::OnMarkerSelectionEvent( wxCommandEvent& event )
520 {
521  int selection = event.GetSelection();
522 
523  if( selection != wxNOT_FOUND )
524  {
525  // until a MARKER is selected, this button is not enabled.
526  m_DeleteCurrentMarkerButton->Enable( true );
527 
528  // Find the selected DRC_ITEM in the listbox, position cursor there.
529  const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );
530  if( item )
531  {
532  auto pos = item->GetPointA();
533 
534  if( auto marker = item->GetParent() )
535  pos = marker->GetPos();
536 
537  // When selecting a item, center it on GAL and just move the graphic
538  // cursor in legacy mode gives the best result
539  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
540  m_brdEditor->FocusOnLocation( pos, false, center );
541  RedrawDrawPanel();
542  }
543  }
544 
545  event.Skip();
546 }
547 
548 
550 {
551  int selection = event.GetSelection();
552 
553  if( selection != wxNOT_FOUND )
554  {
555  // until a MARKER is selected, this button is not enabled.
556  m_DeleteCurrentMarkerButton->Enable( true );
557 
558  // Find the selected DRC_ITEM in the listbox, position cursor there.
559  const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
560 
561  if( item )
562  {
563  // When selecting a item, center it on GAL and just move the graphic
564  // cursor in legacy mode gives the best result
565  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
566  m_brdEditor->FocusOnLocation( item->GetPointA(), false, center );
567  RedrawDrawPanel();
568  }
569  }
570 
571  event.Skip();
572 }
573 
574 
576 {
577  BOARD_THAWER thawer( m_brdEditor );
578 
580 }
581 
582 
584 {
585  m_brdEditor->SetCurItem( NULL ); // clear curr item, because it could be a DRC marker
586 
587  // Clear current selection list to avoid selection of deleted items
589 
592  m_DeleteCurrentMarkerButton->Enable( false );
593 }
594 
595 
597 {
598  wxFileName fn = m_RptFilenameCtrl->GetValue();
599 
600  if( !fn.HasExt() )
601  {
602  fn.SetExt( ReportFileExtension );
603  m_RptFilenameCtrl->SetValue( fn.GetFullPath() );
604  }
605 
606  // Ensure it is an absolute filename. if it is given relative
607  // it will be made relative to the project
608  if( !fn.IsAbsolute() )
609  {
610  wxString prj_path = Prj().GetProjectPath();
611  fn.MakeAbsolute( prj_path );
612  }
613 
614  return fn.GetFullPath();
615 }
616 
617 
618 bool DIALOG_DRC_CONTROL::writeReport( const wxString& aFullFileName )
619 {
620  FILE* fp = wxFopen( aFullFileName, wxT( "w" ) );
621 
622  if( fp == NULL )
623  return false;
624 
625  int count;
626  EDA_UNITS_T units = GetUserUnits();
627 
628  fprintf( fp, "** Drc report for %s **\n",
630 
631  wxDateTime now = wxDateTime::Now();
632 
633  fprintf( fp, "** Created on %s **\n", TO_UTF8( now.Format( wxT( "%F %T" ) ) ) );
634 
635  count = m_ClearanceListBox->GetItemCount();
636 
637  fprintf( fp, "\n** Found %d DRC errors **\n", count );
638 
639  for( int i = 0; i<count; ++i )
640  fprintf( fp, "%s", TO_UTF8( m_ClearanceListBox->GetItem( i )->ShowReport( units ) ) );
641 
642  count = m_UnconnectedListBox->GetItemCount();
643 
644  fprintf( fp, "\n** Found %d unconnected pads **\n", count );
645 
646  for( int i = 0; i<count; ++i )
647  fprintf( fp, "%s", TO_UTF8( m_UnconnectedListBox->GetItem( i )->ShowReport( units ) ) );
648 
649  fprintf( fp, "\n** End of Report **\n" );
650 
651  fclose( fp );
652 
653  return true;
654 }
655 
656 
657 void DIALOG_DRC_CONTROL::OnDeleteOneClick( wxCommandEvent& event )
658 {
659  int selectedIndex;
660  int curTab = m_Notebook->GetSelection();
661 
662  if( curTab == 0 )
663  {
664  selectedIndex = m_ClearanceListBox->GetSelection();
665 
666  if( selectedIndex != wxNOT_FOUND )
667  {
668  m_ClearanceListBox->DeleteItem( selectedIndex );
669 
670  // redraw the pcb
671  RedrawDrawPanel();
672  }
673  }
674  else if( curTab == 1 )
675  {
676  selectedIndex = m_UnconnectedListBox->GetSelection();
677 
678  if( selectedIndex != wxNOT_FOUND )
679  {
680  m_UnconnectedListBox->DeleteItem( selectedIndex );
681 
682  /* these unconnected DRC_ITEMs are not currently visible on the pcb
683  * RedrawDrawPanel();
684  */
685  }
686  }
687 
689 }
690 
691 
693 {
694  int marker_count = m_ClearanceListBox->GetItemCount();
695  int unconnected_count = m_UnconnectedListBox->GetItemCount();
696 
697  m_Notebook->SetPageText( 0, wxString::Format( m_markersTitleTemplate, marker_count ) );
698  m_Notebook->SetPageText( 1, wxString::Format( m_unconnectedTitleTemplate, unconnected_count ) );
699 
700 }
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:119
DIALOG_DRC_CONTROL(DRC *aTester, PCB_EDIT_FRAME *aEditorFrame, wxWindow *aParent)
Constructors.
Definition: dialog_drc.cpp:86
wxStaticText * m_messagesLabel
void UpdateDisplayedCounts()
Definition: dialog_drc.cpp:692
#define ID_CLEARANCE_LIST
BOARD_ITEM * GetAuxiliaryItem(BOARD *aBoard) const
Definition: drc_item.cpp:230
virtual EDA_DRAW_PANEL * GetCanvas() const
Definition: draw_frame.h:375
Class 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:519
bool HasSecondItem() const
Definition: drc_item.h:155
BOARD_THAWER(PCB_EDIT_FRAME *aBoardEditor)
Definition: dialog_drc.cpp:59
BOARD_ITEM * GetMainItem(BOARD *aBoard) const
Access to A and B items for BOARDs.
Definition: drc_item.cpp:224
MARKER_BASE * GetParent() const
Definition: drc_item.h:153
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:549
void OnRightUpClearance(wxMouseEvent &event) override
wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST
Definition: dialog_drc.cpp:447
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:220
void GetRptSettings(bool *aEnable, wxString &aFileName)
Definition: dialog_drc.cpp:213
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...
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:146
wxString ShowReport(EDA_UNITS_T aUnits) const
Function ShowReport translates this object into a text string suitable for saving to disk in a report...
Definition: drc_item.cpp:201
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
static TOOL_ACTION selectionMenu
Runs a selection menu to select from a list of items.
Definition: pcb_actions.h:68
const wxString makeValidFileNameReport()
filenames can be entered by name.
Definition: dialog_drc.cpp:596
void OnLeftDClickClearance(wxMouseEvent &event) override
wxEVT_LEFT_DCLICK event handler for ID_CLEARANCE_LIST
Definition: dialog_drc.cpp:397
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:537
UNIT_BINDER m_viaMinSize
Definition: dialog_drc.h:157
void SkipNextLeftButtonReleaseEvent()
function SkipNextLeftButtonReleaseEvent after calling this function, if the left mouse button is down...
void OnDeleteAllClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ALL
Definition: dialog_drc.cpp:283
DRCLISTBOX * m_UnconnectedListBox
void OnListUnconnectedClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIST_UNCONNECTED
Definition: dialog_drc.cpp:291
BOARD_DESIGN_SETTINGS m_BrdSettings
Definition: dialog_drc.h:56
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
void Append(EDA_ITEM *item)
Function Append adds an item to the end of the list.
Definition: collector.h:125
virtual int GetValue()
Function GetValue Returns the current value in Internal Units.
wxString m_unconnectedTitleTemplate
Definition: dialog_drc.h:154
#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.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
wxString m_markersTitleTemplate
Definition: dialog_drc.h:153
void DeleteAllItems()
Function DeleteAllItems deletes all items in the list.
wxString ReportFileWildcard()
const wxString & GetFileName() const
Definition: class_board.h:237
DRCLISTBOX * m_ClearanceListBox
const DRC_ITEM * GetItem(int aIndex)
Function GetItem returns a requested DRC_ITEM* or NULL.
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:474
int m_ViasMinSize
vias (not micro vias) min diameter
The common library.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:538
wxBitmapButton * m_BrowseButton
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:916
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aDesignSettings)
Function SetDesignSettings.
Definition: class_board.h:548
wxConfigBase * m_config
Definition: dialog_drc.h:151
void OnReportCheckBoxClicked(wxCommandEvent &event) override
wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_RPT_FILE
Definition: dialog_drc.cpp:384
int m_MicroViasMinSize
micro vias (not vias) min diameter
UNIT_BINDER m_uviaMinSize
Definition: dialog_drc.h:158
void OnCancelClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
Definition: dialog_drc.cpp:373
bool Show(bool show) override
UNIT_BINDER m_trackMinWidth
Definition: dialog_drc.h:156
void OnButtonBrowseRptFileClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_BROWSE_RPT_FILE
Definition: dialog_drc.cpp:356
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:618
wxCheckBox * m_cbReportAllTrackErrors
void SetSettings(bool aPad2PadTest, bool aUnconnectedTest, bool aZonesTest, bool aKeepoutTest, bool aRefillZones, 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:508
TOOL_MANAGER * GetToolManager() const
Function GetToolManager returns the tool manager instance, if any.
Definition: draw_frame.h:931
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
see class PGM_BASE
void OnDeleteOneClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ONE
Definition: dialog_drc.cpp:657
const wxPoint & GetPointA() const
Definition: drc_item.h:214
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...
const std::string ReportFileExtension
PCB_EDIT_FRAME * m_boardEditor
Definition: dialog_drc.cpp:81
Design Rule Checker object that performs all the DRC tests.
Definition: drc.h:171
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:232
void doSelectionMenu(const DRC_ITEM *aItem)
Run the SELECTION_TOOL&#39;s disambiguation menu to highlight the two BOARD_ITEMs in the DRC_ITEM...
Definition: dialog_drc.cpp:458
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
size_t i
Definition: json11.cpp:597
Class PCB_EDIT_FRAME is the main frame for Pcbnew.
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:102
#define RefillZonesBeforeDrc
Definition: dialog_drc.cpp:54
void OnRightUpUnconnected(wxMouseEvent &event) override
wxEVT_RIGHT_UP event handler for ID_UNCONNECTED_LIST
Definition: dialog_drc.cpp:436
void OnChangingMarkerList(wxNotebookEvent &event) override
Definition: dialog_drc.cpp:508
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
void OnReportFilenameEdited(wxCommandEvent &event) override
wxEVT_COMMAND_TEXT_UPDATED event handler for m_RptFilenameCtrl
Definition: dialog_drc.cpp:391
void RunTests(wxTextCtrl *aMessages=NULL)
Run all the tests specified with a previous call to SetSettings()
Definition: drc.cpp:390
#define ID_UNCONNECTED_LIST
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
PCB_EDIT_FRAME * m_brdEditor
Definition: dialog_drc.h:150
BOARD * m_currentBoard
Definition: dialog_drc.h:148
EDA_UNITS_T
Definition: common.h:159
void SetRptSettings(bool aEnable, const wxString &aFileName)
Enable/disable the report file creation.
Definition: dialog_drc.cpp:206
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:240
EDA_UNITS_T GetUserUnits() const override
Definition: dialog_shim.h:103