KiCad PCB EDA Suite
dialog_erc.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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 1992-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 <fctsys.h>
27 #include <gestfich.h>
28 #include <pgm_base.h>
29 #include <sch_screen.h>
30 #include <sch_edit_frame.h>
31 #include <schematic.h>
32 #include <invoke_sch_dialog.h>
33 #include <project.h>
34 #include <kiface_i.h>
35 #include <bitmaps.h>
36 #include <reporter.h>
38 #include <sch_view.h>
39 #include <netlist_object.h>
40 #include <sch_marker.h>
41 #include <sch_component.h>
42 #include <connection_graph.h>
43 #include <tools/ee_actions.h>
44 #include <tool/tool_manager.h>
45 #include <dialog_erc.h>
46 #include <erc.h>
47 #include <id.h>
48 #include <confirm.h>
49 #include <wx/ffile.h>
50 #include <erc_item.h>
51 #include <eeschema_settings.h>
52 
54  DIALOG_ERC_BASE( parent, ID_DIALOG_ERC ), // parent looks for this ID explicitly
55  m_parent( parent ),
57 {
58  EESCHEMA_SETTINGS* settings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
60 
63  m_markerDataView->AssociateModel( m_markerTreeModel );
64 
65  wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
66  infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
67  m_textMarkers->SetFont( infoFont );
68  m_titleMessages->SetFont( infoFont );
69 
74 
75  // We use a sdbSizer to get platform-dependent ordering of the action buttons, but
76  // that requires us to correct the button labels here.
77  m_sdbSizer1OK->SetLabel( _( "Run" ) );
78  m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
79  m_sdbSizer1->Layout();
80 
81  m_sdbSizer1OK->SetDefault();
82 
83  // Now all widgets have the size fixed, call FinishDialogSettings
85 }
86 
87 
89 {
90  EESCHEMA_SETTINGS* settings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
91  wxASSERT( settings );
92 
93  if( settings )
95 
96  m_markerTreeModel->DecRef();
97 }
98 
99 
101 {
102  int numErrors = 0;
103  int numWarnings = 0;
104  int numExcluded = 0;
105 
106  if( m_markerProvider )
107  {
111  }
112 
113  m_errorsBadge->SetBitmap( MakeBadge( RPT_SEVERITY_ERROR, numErrors, m_errorsBadge ) );
114  m_warningsBadge->SetBitmap( MakeBadge( RPT_SEVERITY_WARNING, numWarnings, m_warningsBadge ) );
116 }
117 
118 
119 /* Delete the old ERC markers, over the whole hierarchy
120  */
121 void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event )
122 {
124 
126  m_parent->GetCanvas()->Refresh();
127 }
128 
129 
130 // This is a modeless dialog so we have to handle these ourselves.
131 void DIALOG_ERC::OnButtonCloseClick( wxCommandEvent& event )
132 {
133  m_parent->FocusOnItem( nullptr );
134 
135  Close();
136 }
137 
138 
139 void DIALOG_ERC::OnCloseErcDialog( wxCloseEvent& event )
140 {
141  m_parent->FocusOnItem( nullptr );
142 
143  Destroy();
144 }
145 
146 
148 
149 
151 {
152  m_showAll->SetValue( m_severities == RPT_SEVERITY_ALL );
156 }
157 
158 
159 void DIALOG_ERC::OnRunERCClick( wxCommandEvent& event )
160 {
161  wxBusyCursor busy;
163 
164  m_MessagesList->Clear();
165  wxSafeYield(); // m_MarkersList must be redraw
166 
168  TestErc( reporter );
169 }
170 
171 
173 {
174  WINDOW_THAWER thawer( m_parent );
175 
176  m_parent->GetCanvas()->Refresh();
177 }
178 
179 
180 void DIALOG_ERC::TestErc( REPORTER& aReporter )
181 {
182  wxFileName fn;
183 
184  SCHEMATIC* sch = &m_parent->Schematic();
185 
186  // Build the whole sheet list in hierarchy (sheet, not screen)
188 
189  if( m_parent->CheckAnnotate( aReporter, false ) )
190  {
191  if( aReporter.HasMessage() )
192  aReporter.ReportTail( _( "Annotation required!" ), RPT_SEVERITY_ERROR );
193 
194  return;
195  }
196 
197  SCH_SCREENS screens( sch->Root() );
198  ERC_SETTINGS& settings = sch->ErcSettings();
199  ERC_TESTER tester( sch );
200 
201  // Test duplicate sheet names inside a given sheet. While one can have multiple references
202  // to the same file, each must have a unique name.
203  if( settings.IsTestEnabled( ERCE_DUPLICATE_SHEET_NAME ) )
204  {
205  aReporter.ReportTail( _( "Checking sheet names...\n" ), RPT_SEVERITY_INFO );
206  tester.TestDuplicateSheetNames( true );
207  }
208 
209  if( settings.IsTestEnabled( ERCE_BUS_ALIAS_CONFLICT ) )
210  {
211  aReporter.ReportTail( _( "Checking bus conflicts...\n" ), RPT_SEVERITY_INFO );
212  tester.TestConflictingBusAliases();
213  }
214 
215  // The connection graph has a whole set of ERC checks it can run
216  aReporter.ReportTail( _( "Checking conflicts...\n" ) );
218  sch->ConnectionGraph()->RunERC();
219 
220  // Test is all units of each multiunit component have the same footprint assigned.
221  if( settings.IsTestEnabled( ERCE_DIFFERENT_UNIT_FP ) )
222  {
223  aReporter.ReportTail( _( "Checking footprints...\n" ), RPT_SEVERITY_INFO );
224 
225  tester.TestMultiunitFootprints();
226  }
227 
228  std::unique_ptr<NETLIST_OBJECT_LIST> objectsConnectedList( m_parent->BuildNetListBase() );
229 
230  // Reset the connection type indicator
231  objectsConnectedList->ResetConnectionsType();
232 
233  unsigned lastItemIdx = 0;
234  unsigned nextItemIdx = 0;
235  int MinConn = NOC;
236 
237  // Check that a pin appears in only one net. This check is necessary because multi-unit
238  // components that have shared pins could be wired to different nets.
239  std::unordered_map<wxString, wxString> pin_to_net_map;
240 
241  // The netlist generated by SCH_EDIT_FRAME::BuildNetListBase is sorted by net number, which
242  // means we can group netlist items into ranges that live in the same net. The range from
243  // nextItem to the current item (exclusive) needs to be checked against the current item.
244  // The lastItem variable is used as a helper to pass the last item's number from one loop
245  // iteration to the next, which simplifies the initial pass.
246  aReporter.ReportTail( _( "Checking connections...\n" ), RPT_SEVERITY_INFO );
247  for( unsigned itemIdx = 0; itemIdx < objectsConnectedList->size(); itemIdx++ )
248  {
249  auto item = objectsConnectedList->GetItem( itemIdx );
250  auto lastItem = objectsConnectedList->GetItem( lastItemIdx );
251 
252  auto lastNet = lastItem->GetNet();
253  auto net = item->GetNet();
254 
255  wxASSERT_MSG( lastNet <= net, wxT( "Netlist not correctly ordered" ) );
256 
257  if( lastNet != net )
258  {
259  // New net found:
260  MinConn = NOC;
261  nextItemIdx = itemIdx;
262  }
263 
264  switch( item->m_Type )
265  {
266  // These items do not create erc problems
269  case NETLIST_ITEM::BUS:
271  case NETLIST_ITEM::LABEL:
275  break;
276 
277  // TODO(JE) Port this to the new system
278  case NETLIST_ITEM::PIN:
279  {
280  // Check if this pin has appeared before on a different net
281  if( item->m_Link && settings.IsTestEnabled( ERCE_DIFFERENT_UNIT_NET ) )
282  {
283  wxString ref = item->GetComponentParent()->GetRef( &item->m_SheetPath );
284  wxString pin_name = ref + "_" + item->m_PinNum;
285  wxString msg;
286 
287  if( pin_to_net_map.count( pin_name ) == 0 )
288  {
289  pin_to_net_map[pin_name] = item->GetNetName();
290  }
291  else if( pin_to_net_map[pin_name] != item->GetNetName() )
292  {
293  msg.Printf( _( "Pin %s is connected to both %s and %s" ),
294  item->m_PinNum,
295  pin_to_net_map[pin_name],
296  item->GetNetName() );
297 
299  ercItem->SetErrorMessage( msg );
300  ercItem->SetItems( item->m_Comp );
301 
302  SCH_MARKER* marker = new SCH_MARKER( ercItem, item->m_Start );
303  item->m_SheetPath.LastScreen()->Append( marker );
304  }
305  }
306 
307  // Look for ERC problems between pins:
308  tester.TestOthersItems( objectsConnectedList.get(), itemIdx, nextItemIdx, &MinConn );
309  break;
310  }
311  default:
312  break;
313  }
314 
315  lastItemIdx = itemIdx;
316  }
317 
318  // Test similar labels (i;e. labels which are identical when
319  // using case insensitive comparisons)
320  if( settings.IsTestEnabled( ERCE_SIMILAR_LABELS ) )
321  {
322  aReporter.ReportTail( _( "Checking labels...\n" ), RPT_SEVERITY_INFO );
323  objectsConnectedList->TestforSimilarLabels();
324  }
325 
326  if( settings.IsTestEnabled( ERCE_UNRESOLVED_VARIABLE ) )
328 
329  if( settings.IsTestEnabled( ERCE_NOCONNECT_CONNECTED ) )
330  tester.TestNoConnectPins();
331 
332  // Display diags:
334 
335  // Displays global results:
337 
338  // Display new markers from the current screen:
339  KIGFX::VIEW* view = m_parent->GetCanvas()->GetView();
340 
341  for( auto item : m_parent->GetScreen()->Items().OfType( SCH_MARKER_T ) )
342  view->Add( item );
343 
344  m_parent->GetCanvas()->Refresh();
345 
346  // Display message
347  aReporter.ReportTail( _( "Finished" ), RPT_SEVERITY_INFO );
348 }
349 
350 
351 void DIALOG_ERC::OnERCItemSelected( wxDataViewEvent& aEvent )
352 {
353  const KIID& itemID = RC_TREE_MODEL::ToUUID( aEvent.GetItem() );
354  SCH_SHEET_PATH sheet;
355  SCH_ITEM* item = m_parent->Schematic().GetSheets().GetItem( itemID, &sheet );
356 
357  if( item && item->GetClass() != wxT( "DELETED_SHEET_ITEM" ) )
358  {
359  WINDOW_THAWER thawer( m_parent );
360 
361  if( !sheet.empty() && sheet != m_parent->GetCurrentSheet() )
362  {
365 
366  m_parent->SetCurrentSheet( sheet );
369  }
370 
371  m_parent->FocusOnItem( item );
372  RedrawDrawPanel();
373  }
374 
375  aEvent.Skip();
376 }
377 
378 
379 void DIALOG_ERC::OnERCItemDClick( wxDataViewEvent& aEvent )
380 {
381  if( aEvent.GetItem().IsOk() )
382  {
383  // turn control over to m_parent, hide this DIALOG_ERC window,
384  // no destruction so we can preserve listbox cursor
385  if( !IsModal() )
386  Show( false );
387  }
388 
389  aEvent.Skip();
390 }
391 
392 
393 void DIALOG_ERC::OnERCItemRClick( wxDataViewEvent& aEvent )
394 {
395  RC_TREE_NODE* node = RC_TREE_MODEL::ToNode( aEvent.GetItem() );
396 
397  if( !node )
398  return;
399 
400  ERC_SETTINGS& settings = m_parent->Schematic().ErcSettings();
401 
402  RC_ITEM* rcItem = node->m_RcItem;
403  wxString listName;
404  wxMenu menu;
405  wxString msg;
406 
407  switch( settings.GetSeverity( rcItem->GetErrorCode() ) )
408  {
409  case RPT_SEVERITY_ERROR: listName = _( "errors" ); break;
410  case RPT_SEVERITY_WARNING: listName = _( "warnings" ); break;
411  default: listName = _( "appropriate" ); break;
412  }
413 
414  if( rcItem->GetParent()->IsExcluded() )
415  {
416  menu.Append( 1, _( "Remove exclusion for this violation" ),
417  wxString::Format( _( "It will be placed back in the %s list" ), listName ) );
418  }
419  else
420  {
421  menu.Append( 2, _( "Exclude this violation" ),
422  wxString::Format( _( "It will be excluded from the %s list" ), listName ) );
423  }
424 
425  menu.AppendSeparator();
426 
427  if( rcItem->GetErrorCode() == ERCE_PIN_TO_PIN_WARNING
428  || rcItem->GetErrorCode() == ERCE_PIN_TO_PIN_ERROR )
429  {
430  // Pin to pin severities edited through pin conflict map
431  }
432  else if( settings.GetSeverity( rcItem->GetErrorCode() ) == RPT_SEVERITY_WARNING )
433  {
434  menu.Append( 4, wxString::Format( _( "Change severity to Error for all '%s' violations" ),
435  rcItem->GetErrorText() ),
436  _( "Violation severities can also be edited in the Board Setup... dialog" ) );
437  }
438  else
439  {
440  menu.Append( 5, wxString::Format( _( "Change severity to Warning for all '%s' violations" ),
441  rcItem->GetErrorText() ),
442  _( "Violation severities can also be edited in the Board Setup... dialog" ) );
443  }
444 
445  menu.Append( 6, wxString::Format( _( "Ignore all '%s' violations" ), rcItem->GetErrorText() ),
446  _( "Violations will not be checked or reported" ) );
447 
448  menu.AppendSeparator();
449 
450  if( rcItem->GetErrorCode() == ERCE_PIN_TO_PIN_WARNING
451  || rcItem->GetErrorCode() == ERCE_PIN_TO_PIN_ERROR )
452  {
453  menu.Append( 7, _( "Edit pin-to-pin conflict map..." ) );
454  }
455  else
456  {
457  menu.Append( 8, _( "Edit violation severities..." ),
458  _( "Open the Schematic Setup... dialog" ) );
459  }
460 
461  switch( GetPopupMenuSelectionFromUser( menu ) )
462  {
463  case 1:
464  node->m_RcItem->GetParent()->SetExcluded( false );
465 
466  // Update view
467  static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
469  break;
470 
471  case 2:
472  node->m_RcItem->GetParent()->SetExcluded( true );
473 
474  // Update view
476  static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
477  else
478  static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->DeleteCurrentItem( false );
479 
481  break;
482 
483  case 4:
484  settings.SetSeverity( rcItem->GetErrorCode(), RPT_SEVERITY_ERROR );
485 
486  // Rebuild model and view
487  static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markerProvider );
489  break;
490 
491  case 5:
492  settings.SetSeverity( rcItem->GetErrorCode(), RPT_SEVERITY_WARNING );
493 
494  // Rebuild model and view
495  static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markerProvider );
497  break;
498 
499  case 6:
500  {
501  settings.SetSeverity( rcItem->GetErrorCode(), RPT_SEVERITY_IGNORE );
502 
503  if( rcItem->GetErrorCode() == ERCE_PIN_TO_PIN_ERROR )
505 
506  SCH_SCREENS ScreenList( m_parent->Schematic().Root() );
507  ScreenList.DeleteMarkers( MARKER_BASE::MARKER_ERC, rcItem->GetErrorCode() );
508 
509  // Rebuild model and view
510  static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markerProvider );
512  }
513  break;
514 
515  case 7:
516  m_parent->ShowSchematicSetupDialog( _( "Pin Conflicts Map" ) );
517  break;
518 
519  case 8:
520  m_parent->ShowSchematicSetupDialog( _( "Violation Severity" ) );
521  break;
522  }
523 }
524 
525 
526 void DIALOG_ERC::OnSeverity( wxCommandEvent& aEvent )
527 {
528  int flag = 0;
529 
530  if( aEvent.GetEventObject() == m_showAll )
531  flag = RPT_SEVERITY_ALL;
532  else if( aEvent.GetEventObject() == m_showErrors )
533  flag = RPT_SEVERITY_ERROR;
534  else if( aEvent.GetEventObject() == m_showWarnings )
535  flag = RPT_SEVERITY_WARNING;
536  else if( aEvent.GetEventObject() == m_showExclusions )
537  flag = RPT_SEVERITY_EXCLUSION;
538 
539  if( aEvent.IsChecked() )
540  m_severities |= flag;
541  else if( aEvent.GetEventObject() == m_showAll )
543  else
544  m_severities &= ~flag;
545 
546  syncCheckboxes();
547 
548  // Set the provider's severity levels through the TreeModel so that the old tree
549  // can be torn down before the severity changes.
550  //
551  // It's not clear this is required, but we've had a lot of issues with wxDataView
552  // being cranky on various platforms.
553 
555 
557 }
558 
559 
561 {
562  // Clear current selection list to avoid selection of deleted items
564 
566 }
567 
568 
569 void DIALOG_ERC::OnSaveReport( wxCommandEvent& aEvent )
570 {
571  wxFileName fn( "./ERC." + ReportFileExtension );
572 
573  wxFileDialog dlg( this, _( "Save Report to File" ), fn.GetPath(), fn.GetFullName(),
574  ReportFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
575 
576  if( dlg.ShowModal() != wxID_OK )
577  return;
578 
579  fn = dlg.GetPath();
580 
581  if( fn.GetExt().IsEmpty() )
582  fn.SetExt( ReportFileExtension );
583 
584  if( !fn.IsAbsolute() )
585  {
586  wxString prj_path = Prj().GetProjectPath();
587  fn.MakeAbsolute( prj_path );
588  }
589 
590  if( writeReport( fn.GetFullPath() ) )
591  {
592  m_MessagesList->AppendText( wxString::Format( _( "Report file '%s' created\n" ),
593  fn.GetFullPath() ) );
594  }
595  else
596  {
597  DisplayError( this, wxString::Format( _( "Unable to create report file '%s'" ),
598  fn.GetFullPath() ) );
599  }
600 }
601 
602 
603 bool DIALOG_ERC::writeReport( const wxString& aFullFileName )
604 {
605  wxFFile file( aFullFileName, wxT( "wt" ) );
606 
607  if( !file.IsOpened() )
608  return false;
609 
610  wxString msg = wxString::Format( _( "ERC report (%s, Encoding UTF8)\n" ), DateAndTime() );
611 
612  std::map<KIID, EDA_ITEM*> itemMap;
613 
614  int err_count = 0;
615  int warn_count = 0;
616  int total_count = 0;
617  SCH_SHEET_LIST sheetList = m_parent->Schematic().GetSheets();
618 
619  sheetList.FillItemMap( itemMap );
620 
621  ERC_SETTINGS& settings = m_parent->Schematic().ErcSettings();
622 
623  for( unsigned i = 0; i < sheetList.size(); i++ )
624  {
625  msg << wxString::Format( _( "\n***** Sheet %s\n" ), sheetList[i].PathHumanReadable() );
626 
627  for( SCH_ITEM* aItem : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
628  {
629  const SCH_MARKER* marker = static_cast<const SCH_MARKER*>( aItem );
630 
631  if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
632  continue;
633 
634  total_count++;
635 
636  switch( settings.GetSeverity( marker->GetRCItem()->GetErrorCode() ) )
637  {
638  case RPT_SEVERITY_ERROR: err_count++; break;
639  case RPT_SEVERITY_WARNING: warn_count++; break;
640  default: break;
641  }
642 
643  msg << marker->GetRCItem()->ShowReport( GetUserUnits(), itemMap );
644  }
645  }
646 
647  msg << wxString::Format( _( "\n ** ERC messages: %d Errors %d Warnings %d\n" ),
648  total_count, err_count, warn_count );
649 
650  // Currently: write report using UTF8 (as usual in Kicad).
651  // TODO: see if we can use the current encoding page (mainly for Windows users),
652  // Or other format (HTML?)
653  file.Write( msg );
654 
655  // wxFFile dtor will close the file.
656 
657  return true;
658 }
659 
660 
661 wxDialog* InvokeDialogERC( SCH_EDIT_FRAME* aCaller )
662 {
663  // This is a modeless dialog, so new it rather than instantiating on stack.
664  DIALOG_ERC* dlg = new DIALOG_ERC( aCaller );
665 
666  dlg->Show( true );
667 
668  return dlg; // wxDialog is information hiding about DIALOG_ERC.
669 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
SCH_SHEET_LIST.
KIGFX::SCH_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
virtual bool HasMessage() const =0
Function HasMessage Returns true if the reporter client is non-empty.
wxTextCtrl * m_MessagesList
void OnERCItemRClick(wxDataViewEvent &aEvent) override
Definition: dialog_erc.cpp:393
NETLIST_OBJECT_LIST * BuildNetListBase(bool updateStatusText=true)
Create a flat list which stores all connected objects.
virtual void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
#define NOC
Definition: erc_settings.h:79
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:92
void SetProvider(RC_ITEMS_PROVIDER *aProvider)
Definition: rc_item.cpp:206
This file is part of the common library TODO brief description.
RC_ITEM * GetRCItem()
Function GetReporter returns the DRC_ITEM held within this MARKER so that its interface may be used.
Definition: marker_base.h:117
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generates the connection data for the entire schematic hierarchy.
SCH_ITEM * GetItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr)
Fetch a SCH_ITEM by ID.
RC_TREE_MODEL * m_markerTreeModel
Definition: dialog_erc.h:43
Holds all the data relating to one schematic A schematic may consist of one or more sheets (and one r...
Definition: schematic.h:42
CONNECTION_GRAPH * ConnectionGraph() const
Definition: schematic.h:132
This file is part of the common library.
void syncCheckboxes()
Definition: dialog_erc.cpp:150
Class DIALOG_ERC_BASE.
void SetItems(EDA_ITEM *aItem, EDA_ITEM *bItem=nullptr, EDA_ITEM *cItem=nullptr, EDA_ITEM *dItem=nullptr)
Definition: rc_item.h:119
RC_ITEM is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item.
Definition: rc_item.h:77
bool writeReport(const wxString &aFullFileName)
Definition: dialog_erc.cpp:603
void OnEraseDrcMarkersClick(wxCommandEvent &event) override
Definition: dialog_erc.cpp:121
EE_TYPE OfType(KICAD_T aType)
Definition: sch_rtree.h:219
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Function ReportTail Places the report at the end of the list, for objects that support report orderin...
Definition: reporter.h:94
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
RC_ITEMS_PROVIDER * m_markerProvider
Definition: dialog_erc.h:42
void TestOthersItems(NETLIST_OBJECT_LIST *aList, unsigned aNetItemRef, unsigned aNetStart, int *aMinConnexion)
Perform ERC testing for electrical conflicts between NetItemRef and other items (mainly pin) on the s...
wxCheckBox * m_showExclusions
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
void TestTextVars(KIGFX::WS_PROXY_VIEW_ITEM *aWorksheet)
Checks for any unresolved text variable references.
void updateDisplayedCounts()
Definition: dialog_erc.cpp:100
Definition: erc.h:51
WS_PROXY_VIEW_ITEM * GetWorksheet() const
Definition: sch_view.h:101
virtual int GetCount(int aSeverity=-1)=0
Schematic editor (Eeschema) main window.
static KIID ToUUID(wxDataViewItem aItem)
Definition: rc_item.cpp:91
void DisplayCurrentSheet()
Draw the current sheet on the display.
Definition: hierarch.cpp:229
REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:64
void OnSeverity(wxCommandEvent &aEvent) override
Definition: dialog_erc.cpp:526
SHEETLIST_ERC_ITEMS_PROVIDER is an implementation of the RC_ITEM_LISTinterface which uses the global ...
Definition: erc_settings.h:173
wxButton * m_sdbSizer1Cancel
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:122
static int RPT_SEVERITY_ALL
Definition: dialog_erc.cpp:147
WX_TEXT_CTRL_REPORTER is wrapper for reporting to a wxTextCtrl object.
Definition: reporter.h:131
void SetSeverities(int aSeverities)
Definition: rc_item.cpp:212
wxString GetErrorText() const
Definition: rc_item.h:169
EDA_UNITS GetUserUnits() const
Definition: dialog_shim.h:131
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void FillItemMap(std::map< KIID, EDA_ITEM * > &aMap)
Fill an item cache for temporary use when many items need to be fetched.
void SetSeverity(int aErrorCode, int aSeverity)
Definition: common.h:68
wxCheckBox * m_showAll
virtual wxString ShowReport(EDA_UNITS aUnits, const std::map< KIID, EDA_ITEM * > &aItemMap) const
Function ShowReport translates this object into a text string suitable for saving to disk in a report...
Definition: rc_item.cpp:53
void SetExcluded(bool aExcluded)
Definition: marker_base.h:109
int TestConflictingBusAliases()
Checks that there are not conflicting bus alias definitions in the schematic.
int GetSeverity(int aErrorCode) const
void deleteAllMarkers()
Definition: dialog_erc.cpp:560
wxButton * m_sdbSizer1OK
static RC_TREE_NODE * ToNode(wxDataViewItem aItem)
Definition: rc_item.h:220
wxString ReportFileWildcard()
void RedrawDrawPanel()
Definition: dialog_erc.cpp:172
int TestMultiunitFootprints()
Test if all units of each multiunit component have the same footprint assigned.
wxStdDialogButtonSizer * m_sdbSizer1
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
wxStaticText * m_textMarkers
int GetErrorCode() const
Definition: rc_item.h:160
SCHEMATIC & Schematic() const
Definition of file extensions used in Kicad.
wxStaticBitmap * m_warningsBadge
int m_severities
Definition: dialog_erc.h:45
DIALOG_ERC(SCH_EDIT_FRAME *parent)
Definition: dialog_erc.cpp:53
void OnButtonCloseClick(wxCommandEvent &event) override
Definition: dialog_erc.cpp:131
bool IsExcluded() const
Definition: marker_base.h:108
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
Container for ERC settings.
Definition: erc_settings.h:87
SCH_SHEET_PATH.
void OnERCItemSelected(wxDataViewEvent &aEvent) override
Definition: dialog_erc.cpp:351
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:40
wxStaticBitmap * m_errorsBadge
bool Show(bool show) override
void OnCloseErcDialog(wxCloseEvent &event) override
Definition: dialog_erc.cpp:139
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...
int CheckAnnotate(REPORTER &aReporter, bool aOneSheetOnly)
Check for annotation errors.
void OnERCItemDClick(wxDataViewEvent &aEvent) override
Definition: dialog_erc.cpp:379
void DeleteAllItems()
Definition: rc_item.cpp:406
wxCheckBox * m_showWarnings
eeschema ERC modeless dialog ID
Definition: id.h:184
RC_ITEM * m_RcItem
Definition: rc_item.h:205
static ERC_ITEM * Create(int aErrorCode)
Constructs an ERC_ITEM for the given error code.
Definition: erc_item.cpp:144
wxCheckBox * m_showErrors
SCH_SHEET & Root() const
Definition: schematic.h:97
see class PGM_BASE
wxDataViewCtrl * m_markerDataView
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
enum TYPEMARKER GetMarkerType() const
Definition: marker_base.h:106
const std::string ReportFileExtension
wxBitmap MakeBadge(SEVERITY aStyle, int aCount, wxWindow *aWindow, int aDepth)
Definition: ui_common.cpp:36
wxStaticText * m_titleMessages
#define _(s)
Definition: 3d_actions.cpp:33
EE_RTREE & Items()
Definition: sch_screen.h:158
void OnSaveReport(wxCommandEvent &aEvent) override
Definition: dialog_erc.cpp:569
wxStaticBitmap * m_exclusionsBadge
virtual wxString GetClass() const override
Function GetClass returns the class name.
Definition: sch_item.h:214
SCH_SHEET_PATH & GetCurrentSheet() const
void SetErrorMessage(const wxString &aMessage)
Definition: rc_item.h:117
MARKER_BASE * GetParent() const
Definition: rc_item.h:149
void FocusOnItem(SCH_ITEM *aItem)
void AnnotatePowerSymbols()
Function AnnotatePowerSymbols Silently annotates the not yet annotated power symbols of the entire hi...
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
VECTOR2D m_ScrollCenter
Current scroll center point in logical units.
Definition: base_screen.h:77
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:74
ERC_SETTINGS & ErcSettings() const
Definition: schematic.cpp:145
VIEW.
Definition: view.h:61
void TestErc(REPORTER &aReporter)
Definition: dialog_erc.cpp:180
Definition of the NETLIST_OBJECT class.
void ShowSchematicSetupDialog(const wxString &aInitialPage=wxEmptyString)
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:187
wxDialog * InvokeDialogERC(SCH_EDIT_FRAME *aCaller)
Create the modeless DIALOG_ERC and show it, return something to destroy or close it.
Definition: dialog_erc.cpp:661
int TestNoConnectPins()
In KiCad 5 and earlier, you could connect stuff up to pins with NC electrical type.
int RunERC()
Runs electrical rule checks on the connectivity graph.
wxString DateAndTime()
Definition: string.cpp:379
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:546
void DeleteMarkers(enum MARKER_BASE::TYPEMARKER aMarkerTyp, int aErrorCode)
Delete all markers of a particular type and error code.
int TestDuplicateSheetNames(bool aCreateMarker)
inside a given sheet, one cannot have sheets with duplicate names (file names can be duplicated).
void OnRunERCClick(wxCommandEvent &event) override
Definition: dialog_erc.cpp:159