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  wxWindow* aParent ) :
59  DIALOG_DRC_CONTROL_BASE( aParent ),
60  m_trackMinWidth( aEditorFrame, m_TrackMinWidthTitle, m_SetTrackMinWidthCtrl, m_TrackMinWidthUnit, true ),
61  m_viaMinSize( aEditorFrame, m_ViaMinTitle, m_SetViaMinSizeCtrl, m_ViaMinUnit, true ),
62  m_uviaMinSize( aEditorFrame, m_MicroViaMinTitle, m_SetMicroViakMinSizeCtrl, m_MicroViaMinUnit, true )
63 {
65  m_tester = aTester;
66  m_brdEditor = aEditorFrame;
69 
70  wxFont messagesLabelFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
71  messagesLabelFont.SetSymbolicSize( wxFONTSIZE_SMALL );
72  m_messagesLabel->SetFont( messagesLabelFont );
73 
74  m_BrowseButton->SetBitmap( KiBitmap( folder_xpm ) );
75 
76  // We use a sdbSizer here to get the order right, which is platform-dependent
77  m_sdbSizer1OK->SetLabel( _( "Run DRC" ) );
78  m_sdbSizer1Apply->SetLabel( _( "List Unconnected" ) );
79  m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
80  m_sizerButtons->Layout();
81 
82  m_sdbSizer1OK->SetDefault();
83 
84  InitValues();
85 
86  // Connect events
87  m_ClearanceListBox->Connect( ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK,
88  wxMouseEventHandler( DIALOG_DRC_CONTROL::OnLeftDClickClearance ), NULL, this );
89  m_ClearanceListBox->Connect( ID_CLEARANCE_LIST, wxEVT_RIGHT_UP,
90  wxMouseEventHandler( DIALOG_DRC_CONTROL::OnRightUpClearance ), NULL, this );
91  m_UnconnectedListBox->Connect( ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK,
92  wxMouseEventHandler( DIALOG_DRC_CONTROL::OnLeftDClickUnconnected ), NULL, this );
93  m_UnconnectedListBox->Connect( ID_UNCONNECTED_LIST, wxEVT_RIGHT_UP,
94  wxMouseEventHandler( DIALOG_DRC_CONTROL::OnRightUpUnconnected ), NULL, this );
95 
96  // Now all widgets have the size fixed, call FinishDialogSettings
98 }
99 
100 
102 {
103  m_config->Write( RefillZonesBeforeDrc, m_cbRefillZones->GetValue() );
104 
105  // Disconnect events
106  m_ClearanceListBox->Disconnect( ID_CLEARANCE_LIST, wxEVT_LEFT_DCLICK,
107  wxMouseEventHandler( DIALOG_DRC_CONTROL::OnLeftDClickClearance ), NULL, this );
108  m_ClearanceListBox->Disconnect( ID_CLEARANCE_LIST, wxEVT_RIGHT_UP,
109  wxMouseEventHandler( DIALOG_DRC_CONTROL::OnRightUpClearance ), NULL, this );
110  m_UnconnectedListBox->Disconnect( ID_UNCONNECTED_LIST, wxEVT_LEFT_DCLICK,
111  wxMouseEventHandler( DIALOG_DRC_CONTROL::OnLeftDClickUnconnected ), NULL, this );
112  m_UnconnectedListBox->Disconnect( ID_UNCONNECTED_LIST, wxEVT_RIGHT_UP,
113  wxMouseEventHandler( DIALOG_DRC_CONTROL::OnRightUpUnconnected ), NULL, this );
114 }
115 
116 
117 void DIALOG_DRC_CONTROL::OnActivateDlg( wxActivateEvent& event )
118 {
120  {
121  // If m_currentBoard is not the current parent board,
122  // (for instance because a new board was loaded),
123  // close the dialog, because many pointers are now invalid
124  // in lists
125  SetReturnCode( wxID_CANCEL );
126  Close();
127  m_tester->DestroyDRCDialog( wxID_CANCEL );
128  return;
129  }
130 
131  // updating data which can be modified outside the dialog (DRC parameters, units ...)
132  // because the dialog is not modal
135 }
136 
137 
139 {
143 }
144 
145 
147 {
148  m_markersTitleTemplate = m_Notebook->GetPageText( 0 );
149  m_unconnectedTitleTemplate = m_Notebook->GetPageText( 1 );
150 
151  m_DeleteCurrentMarkerButton->Enable( false );
152 
154 
155  // read options
156  bool value;
157  m_config->Read( RefillZonesBeforeDrc, &value, false );
158  m_cbRefillZones->SetValue( value );
159 
160  Layout(); // adding the units above expanded Clearance text, now resize.
161 
162  SetFocus();
163 }
164 
165 /* accept DRC parameters (min clearance value and min sizes
166 */
168 {
172 
174 }
175 
176 
177 void DIALOG_DRC_CONTROL::SetRptSettings( bool aEnable, const wxString& aFileName )
178 {
179  m_RptFilenameCtrl->SetValue( aFileName );
180  m_CreateRptCtrl->SetValue( aEnable );
181 }
182 
183 
184 void DIALOG_DRC_CONTROL::GetRptSettings( bool* aEnable, wxString& aFileName )
185 {
186  *aEnable = m_CreateRptCtrl->GetValue();
187  aFileName = m_RptFilenameCtrl->GetValue();
188 }
189 
190 
191 void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
192 {
193  wxString reportName, msg;
194 
195  bool make_report = m_CreateRptCtrl->IsChecked();
196 
197  if( make_report ) // Create a rpt file
198  {
199  reportName = m_RptFilenameCtrl->GetValue();
200 
201  if( reportName.IsEmpty() )
202  {
203  wxCommandEvent dummy;
205  }
206 
207  if( !reportName.IsEmpty() )
208  reportName = makeValidFileNameReport();
209  }
210 
211  SetDrcParmeters();
212  m_tester->SetSettings( true, // Pad to pad DRC test enabled
213  true, // unconnected pads DRC test enabled
214  true, // DRC test for zones enabled
215  true, // DRC test for keepout areas enabled
216  m_cbRefillZones->GetValue(),
217  m_cbReportAllTrackErrors->GetValue(),
218  reportName, make_report );
219 
220  DelDRCMarkers();
221 
222  wxBeginBusyCursor();
223  wxWindowDisabler disabler;
224 
225  // run all the tests, with no UI at this time.
226  m_Messages->Clear();
227  wxSafeYield(); // Allows time slice to refresh the Messages
228  m_brdEditor->GetBoard()->m_Status_Pcb = 0; // Force full connectivity and ratsnest calculations
230  m_Notebook->ChangeSelection( 0 ); // display the "Problems/Markers" tab
231 
232  // Generate the report
233  if( !reportName.IsEmpty() )
234  {
235  if( writeReport( reportName ) )
236  {
237  msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) );
238  wxMessageDialog popupWindow( this, msg, _( "Disk File Report Completed" ) );
239  popupWindow.ShowModal();
240  }
241  else
242  {
243  msg.Printf( _( "Unable to create report file \"%s\"" ), GetChars( reportName ) );
244  DisplayError( this, msg );
245  }
246  }
247 
248  wxEndBusyCursor();
249 
250  RedrawDrawPanel();
251 }
252 
253 
254 void DIALOG_DRC_CONTROL::OnDeleteAllClick( wxCommandEvent& event )
255 {
256  DelDRCMarkers();
257  RedrawDrawPanel();
259 }
260 
261 
262 void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
263 {
264  wxString reportName, msg;
265 
266  bool make_report = m_CreateRptCtrl->IsChecked();
267 
268  if( make_report ) // Create a file rpt
269  {
270  reportName = m_RptFilenameCtrl->GetValue();
271 
272  if( reportName.IsEmpty() )
273  {
274  wxCommandEvent junk;
276  }
277 
278  if( !reportName.IsEmpty() )
279  reportName = makeValidFileNameReport();
280  }
281 
282  SetDrcParmeters();
283 
284  m_tester->SetSettings( true, // Pad to pad DRC test enabled
285  true, // unconnected pads DRC test enabled
286  true, // DRC test for zones enabled
287  true, // DRC test for keepout areas enabled
288  m_cbRefillZones->GetValue(),
289  m_cbReportAllTrackErrors->GetValue(),
290  reportName, make_report );
291 
292  DelDRCMarkers();
293 
294  wxBeginBusyCursor();
295 
296  m_Messages->Clear();
298 
299  m_Notebook->ChangeSelection( 1 ); // display the "Unconnected" tab
300 
301  // Generate the report
302  if( !reportName.IsEmpty() )
303  {
304  if( writeReport( reportName ) )
305  {
306  msg.Printf( _( "Report file \"%s\" created" ), GetChars( reportName ) );
307  wxMessageDialog popupWindow( this, msg, _( "Disk File Report Completed" ) );
308  popupWindow.ShowModal();
309  }
310  else
311  {
312  msg.Printf( _( "Unable to create report file \"%s\"" ), GetChars( reportName ) );
313  DisplayError( this, msg );
314  }
315  }
316 
318 
319  wxEndBusyCursor();
320 
321  /* there is currently nothing visible on the DrawPanel for unconnected pads
322  * RedrawDrawPanel();
323  */
324 }
325 
326 
328 {
329  wxFileName fn = m_brdEditor->GetBoard()->GetFileName();
330  fn.SetExt( ReportFileExtension );
331  wxString prj_path = Prj().GetProjectPath();
332 
333  wxFileDialog dlg( this, _( "Save DRC Report File" ), prj_path, fn.GetFullName(),
334  ReportFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
335 
336  if( dlg.ShowModal() == wxID_CANCEL )
337  return;
338 
339  m_CreateRptCtrl->SetValue( true );
340  m_RptFilenameCtrl->SetValue( dlg.GetPath() );
341 }
342 
343 
344 void DIALOG_DRC_CONTROL::OnCancelClick( wxCommandEvent& event )
345 {
346  SetReturnCode( wxID_CANCEL );
347  SetDrcParmeters();
348 
349  // The dialog can be modal or not modal.
350  // Leave the DRC caller destroy (or not) the dialog
351  m_tester->DestroyDRCDialog( wxID_CANCEL );
352 }
353 
354 
355 void DIALOG_DRC_CONTROL::OnReportCheckBoxClicked( wxCommandEvent& event )
356 {
357  if( m_CreateRptCtrl->IsChecked() )
358  m_RptFilenameCtrl->SetFocus();
359 }
360 
361 
362 void DIALOG_DRC_CONTROL::OnReportFilenameEdited( wxCommandEvent &event )
363 {
364  m_CreateRptCtrl->SetValue( event.GetString().Length() );
365 }
366 
367 
368 void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event )
369 {
370  event.Skip();
371 
372  int selection = m_ClearanceListBox->GetSelection();
373 
374  if( selection != wxNOT_FOUND )
375  {
376  // Find the selected MARKER in the PCB, position cursor there.
377  // Then close the dialog.
378  const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );
379 
380  if( item )
381  {
382  auto pos = item->GetPointA();
383 
384  if( auto marker = item->GetParent() )
385  pos = marker->GetPos();
386 
387  // When selecting a item, center it on GAL and just move the graphic
388  // cursor in legacy mode gives the best result
389  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
390  m_brdEditor->FocusOnLocation( pos, true, center );
391 
392  if( !IsModal() )
393  {
394  // turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window,
395  // no destruction so we can preserve listbox cursor
396  Show( false );
397 
398  // We do not want the clarify selection popup when releasing the
399  // left button in the main window
401  }
402  }
403  }
404 }
405 
406 
407 void DIALOG_DRC_CONTROL::OnRightUpUnconnected( wxMouseEvent& event )
408 {
409  // popup menu to go to either of the items listed in the DRC_ITEM.
410 
411  int selection = m_UnconnectedListBox->GetSelection();
412 
413  if( selection != wxNOT_FOUND )
415 }
416 
417 
418 void DIALOG_DRC_CONTROL::OnRightUpClearance( wxMouseEvent& event )
419 {
420  // popup menu to go to either of the items listed in the DRC_ITEM.
421 
422  int selection = m_ClearanceListBox->GetSelection();
423 
424  if( selection != wxNOT_FOUND )
425  doSelectionMenu( m_ClearanceListBox->GetItem( selection ) );
426 }
427 
428 
430 {
431  // popup menu to go to either of the items listed in the DRC_ITEM.
432  GENERAL_COLLECTOR items;
433 
434  items.Append( aItem->GetMainItem( m_brdEditor->GetBoard() ) );
435 
436  if( aItem->HasSecondItem() )
437  items.Append( aItem->GetAuxiliaryItem( m_brdEditor->GetBoard() ) );
438 
439  WINDOW_THAWER thawer( m_brdEditor );
442 }
443 
444 
446 {
447  event.Skip();
448 
449  int selection = m_UnconnectedListBox->GetSelection();
450 
451  if( selection != wxNOT_FOUND )
452  {
453  // Find the selected DRC_ITEM in the listbox, position cursor there.
454  // Then hide the dialog.
455  const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
456  if( item )
457  {
458  // When selecting a item, center it on GAL and just move the graphic
459  // cursor in legacy mode gives the best result
460  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
461  m_brdEditor->FocusOnLocation( item->GetPointA(), true, center );
462 
463  if( !IsModal() )
464  {
465  Show( false );
466 
467  // We do not want the clarify selection popup when releasing the
468  // left button in the main window
470  }
471  }
472  }
473 }
474 
475 
476 /* called when switching from Error list to Unconnected list
477  * To avoid mistakes, the current marker is selection is cleared
478  */
479 void DIALOG_DRC_CONTROL::OnChangingMarkerList( wxNotebookEvent& event )
480 {
481  // Shouldn't be necessary, but is on at least OSX
482  m_Notebook->ChangeSelection( event.GetSelection() );
483 
484  m_DeleteCurrentMarkerButton->Enable( false );
485  m_ClearanceListBox->SetSelection( -1 );
486  m_UnconnectedListBox->SetSelection( -1 );
487 }
488 
489 
490 void DIALOG_DRC_CONTROL::OnMarkerSelectionEvent( wxCommandEvent& event )
491 {
492  int selection = event.GetSelection();
493 
494  if( selection != wxNOT_FOUND )
495  {
496  // until a MARKER is selected, this button is not enabled.
497  m_DeleteCurrentMarkerButton->Enable( true );
498 
499  // Find the selected DRC_ITEM in the listbox, position cursor there.
500  const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );
501  if( item )
502  {
503  auto pos = item->GetPointA();
504 
505  if( auto marker = item->GetParent() )
506  pos = marker->GetPos();
507 
508  // When selecting a item, center it on GAL and just move the graphic
509  // cursor in legacy mode gives the best result
510  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
511  m_brdEditor->FocusOnLocation( pos, false, center );
512  RedrawDrawPanel();
513  }
514  }
515 
516  event.Skip();
517 }
518 
519 
521 {
522  int selection = event.GetSelection();
523 
524  if( selection != wxNOT_FOUND )
525  {
526  // until a MARKER is selected, this button is not enabled.
527  m_DeleteCurrentMarkerButton->Enable( true );
528 
529  // Find the selected DRC_ITEM in the listbox, position cursor there.
530  const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
531 
532  if( item )
533  {
534  // When selecting a item, center it on GAL and just move the graphic
535  // cursor in legacy mode gives the best result
536  bool center = m_brdEditor->IsGalCanvasActive() ? true : false;
537  m_brdEditor->FocusOnLocation( item->GetPointA(), false, center );
538  RedrawDrawPanel();
539  }
540  }
541 
542  event.Skip();
543 }
544 
545 
547 {
548  WINDOW_THAWER thawer( m_brdEditor );
549 
551 }
552 
553 
555 {
556  m_brdEditor->SetCurItem( NULL ); // clear curr item, because it could be a DRC marker
557 
558  // Clear current selection list to avoid selection of deleted items
560 
563  m_DeleteCurrentMarkerButton->Enable( false );
564 }
565 
566 
568 {
569  wxFileName fn = m_RptFilenameCtrl->GetValue();
570 
571  if( !fn.HasExt() )
572  {
573  fn.SetExt( ReportFileExtension );
574  m_RptFilenameCtrl->SetValue( fn.GetFullPath() );
575  }
576 
577  // Ensure it is an absolute filename. if it is given relative
578  // it will be made relative to the project
579  if( !fn.IsAbsolute() )
580  {
581  wxString prj_path = Prj().GetProjectPath();
582  fn.MakeAbsolute( prj_path );
583  }
584 
585  return fn.GetFullPath();
586 }
587 
588 
589 bool DIALOG_DRC_CONTROL::writeReport( const wxString& aFullFileName )
590 {
591  FILE* fp = wxFopen( aFullFileName, wxT( "w" ) );
592 
593  if( fp == NULL )
594  return false;
595 
596  int count;
597  EDA_UNITS_T units = GetUserUnits();
598 
599  fprintf( fp, "** Drc report for %s **\n",
601 
602  wxDateTime now = wxDateTime::Now();
603 
604  fprintf( fp, "** Created on %s **\n", TO_UTF8( now.Format( wxT( "%F %T" ) ) ) );
605 
606  count = m_ClearanceListBox->GetItemCount();
607 
608  fprintf( fp, "\n** Found %d DRC errors **\n", count );
609 
610  for( int i = 0; i<count; ++i )
611  fprintf( fp, "%s", TO_UTF8( m_ClearanceListBox->GetItem( i )->ShowReport( units ) ) );
612 
613  count = m_UnconnectedListBox->GetItemCount();
614 
615  fprintf( fp, "\n** Found %d unconnected pads **\n", count );
616 
617  for( int i = 0; i<count; ++i )
618  fprintf( fp, "%s", TO_UTF8( m_UnconnectedListBox->GetItem( i )->ShowReport( units ) ) );
619 
620  fprintf( fp, "\n** End of Report **\n" );
621 
622  fclose( fp );
623 
624  return true;
625 }
626 
627 
628 void DIALOG_DRC_CONTROL::OnDeleteOneClick( wxCommandEvent& event )
629 {
630  int selectedIndex;
631  int curTab = m_Notebook->GetSelection();
632 
633  if( curTab == 0 )
634  {
635  selectedIndex = m_ClearanceListBox->GetSelection();
636 
637  if( selectedIndex != wxNOT_FOUND )
638  {
639  m_ClearanceListBox->DeleteItem( selectedIndex );
640 
641  // redraw the pcb
642  RedrawDrawPanel();
643  }
644  }
645  else if( curTab == 1 )
646  {
647  selectedIndex = m_UnconnectedListBox->GetSelection();
648 
649  if( selectedIndex != wxNOT_FOUND )
650  {
651  m_UnconnectedListBox->DeleteItem( selectedIndex );
652 
653  /* these unconnected DRC_ITEMs are not currently visible on the pcb
654  * RedrawDrawPanel();
655  */
656  }
657  }
658 
660 }
661 
662 
664 {
665  int marker_count = m_ClearanceListBox->GetItemCount();
666  int unconnected_count = m_UnconnectedListBox->GetItemCount();
667 
668  m_Notebook->SetPageText( 0, wxString::Format( m_markersTitleTemplate, marker_count ) );
669  m_Notebook->SetPageText( 1, wxString::Format( m_unconnectedTitleTemplate, unconnected_count ) );
670 
671 }
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:57
wxStaticText * m_messagesLabel
void UpdateDisplayedCounts()
Definition: dialog_drc.cpp:663
#define ID_CLEARANCE_LIST
BOARD_ITEM * GetAuxiliaryItem(BOARD *aBoard) const
Definition: drc_item.cpp:234
virtual EDA_DRAW_PANEL * GetCanvas() const
Definition: draw_frame.h:388
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:490
bool HasSecondItem() const
Definition: drc_item.h:155
BOARD_ITEM * GetMainItem(BOARD *aBoard) const
Access to A and B items for BOARDs.
Definition: drc_item.cpp:228
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:520
void OnRightUpClearance(wxMouseEvent &event) override
wxEVT_RIGHT_UP event handler for ID_CLEARANCE_LIST
Definition: dialog_drc.cpp:418
void OnStartdrcClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_STARTDRC
Definition: dialog_drc.cpp:191
void GetRptSettings(bool *aEnable, wxString &aFileName)
Definition: dialog_drc.cpp:184
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:117
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:205
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:567
void OnLeftDClickClearance(wxMouseEvent &event) override
wxEVT_LEFT_DCLICK event handler for ID_CLEARANCE_LIST
Definition: dialog_drc.cpp:368
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:544
UNIT_BINDER m_viaMinSize
Definition: dialog_drc.h:157
void SkipNextLeftButtonReleaseEvent()
After calling this function, if the left mouse button is down, the next left mouse button release eve...
void OnDeleteAllClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_DELETE_ALL
Definition: dialog_drc.cpp:254
void FocusOnLocation(const wxPoint &aPos, bool aWarpCursor=true, bool aCenterView=false)
Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor...
DRCLISTBOX * m_UnconnectedListBox
void OnListUnconnectedClick(wxCommandEvent &event) override
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIST_UNCONNECTED
Definition: dialog_drc.cpp:262
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:133
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)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
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:445
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:921
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:355
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:344
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:327
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:589
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:517
TOOL_MANAGER * GetToolManager() const
Return the tool manager instance, if any.
Definition: draw_frame.h:934
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:628
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
Design Rule Checker object that performs all the DRC tests.
Definition: drc.h:174
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:245
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:429
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:407
void OnChangingMarkerList(wxNotebookEvent &event) override
Definition: dialog_drc.cpp:479
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:362
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:177
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:132