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 <invoke_sch_dialog.h>
32 #include <project.h>
33 #include <kiface_i.h>
34 #include <bitmaps.h>
35 #include <reporter.h>
37 #include <sch_view.h>
38 #include <netlist_object.h>
39 #include <sch_marker.h>
40 #include <sch_sheet.h>
41 #include <lib_pin.h>
42 #include <sch_component.h>
43 #include <connection_graph.h>
44 #include <tools/ee_actions.h>
45 #include <tool/tool_manager.h>
46 #include <dialog_erc.h>
47 #include <erc.h>
48 #include <id.h>
49 
50 
53 
54 
55 bool DIALOG_ERC::m_diagErcTableInit = false; // saved only for the current session
56 
57 // Control identifiers for events
58 #define ID_MATRIX_0 1800
59 
60 
61 BEGIN_EVENT_TABLE( DIALOG_ERC, DIALOG_ERC_BASE )
63  wxEVT_COMMAND_BUTTON_CLICKED, DIALOG_ERC::ChangeErrorLevel )
64 END_EVENT_TABLE()
65 
66 
68  DIALOG_ERC_BASE( parent, ID_DIALOG_ERC ), // parent looks for this ID explicitly
69  m_buttonList(),
70  m_initialized( false ),
71  m_settings()
72 {
73  m_parent = parent;
74  m_lastMarkerFound = nullptr;
75 
76  wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
77  infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
78  m_textMarkers->SetFont( infoFont );
79  m_titleMessages->SetFont( infoFont );
80 
81  Init();
82 
83  // We use a sdbSizer to get platform-dependent ordering of the action buttons, but
84  // that requires us to correct the button labels here.
85  m_sdbSizer1OK->SetLabel( _( "Run" ) );
86  m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
87  m_sdbSizer1->Layout();
88 
89  m_sdbSizer1OK->SetDefault();
90 
91  // Now all widgets have the size fixed, call FinishDialogSettings
92  FinishDialogSettings();
93 }
94 
95 
97 {
99 
101  {
103  m_parent->SaveProjectSettings( false );
104  }
105 }
106 
107 
109 {
110  m_initialized = false;
111 
112  for( auto& buttonRow : m_buttonList )
113  {
114  for( auto& button : buttonRow )
115  button = NULL;
116  }
117 
120 
121  SCH_SCREENS screens;
122  updateMarkerCounts( &screens );
123 
125 
126  // Init Panel Matrix
128 }
129 
130 
131 void DIALOG_ERC::OnUpdateUI( wxUpdateUIEvent& event )
132 {
133  m_buttondelmarkers->Show( m_NoteBook->GetSelection() == 0 );
134  m_ResetOptButton->Show( m_NoteBook->GetSelection() == 1 );
135  m_buttonsSizer->Layout();
136 }
137 
138 
140 {
148 }
149 
150 
152 {
160 }
161 
162 
164 {
165  int markers = screens->GetMarkerCount( MARKER_BASE::MARKER_ERC,
167  int warnings = screens->GetMarkerCount( MARKER_BASE::MARKER_ERC,
169  int errors = screens->GetMarkerCount( MARKER_BASE::MARKER_ERC,
171 
172  wxString num;
173  num.Printf( wxT( "%d" ), markers );
174  m_TotalErrCount->SetValue( num );
175 
176  num.Printf( wxT( "%d" ), errors );
177  m_LastErrCount->SetValue( num );
178 
179  num.Printf( wxT( "%d" ), warnings );
180  m_LastWarningCount->SetValue( num );
181 }
182 
183 
184 /* Delete the old ERC markers, over the whole hierarchy
185  */
186 void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event )
187 {
188  SCH_SCREENS ScreenList;
189 
191  updateMarkerCounts( &ScreenList );
192 
194  m_parent->GetCanvas()->Refresh();
195 }
196 
197 
198 // This is a modeless dialog so we have to handle these ourselves.
199 void DIALOG_ERC::OnButtonCloseClick( wxCommandEvent& event )
200 {
201  Close();
202 }
203 
204 
205 void DIALOG_ERC::OnCloseErcDialog( wxCloseEvent& event )
206 {
207  Destroy();
208 }
209 
210 
211 void DIALOG_ERC::OnResetMatrixClick( wxCommandEvent& event )
212 {
213  ResetDefaultERCDiag( event );
214 }
215 
216 
217 void DIALOG_ERC::OnErcCmpClick( wxCommandEvent& event )
218 {
219  wxBusyCursor busy;
221 
222  m_MessagesList->Clear();
223  wxSafeYield(); // m_MarkersList must be redraw
224 
226  TestErc( reporter );
227 }
228 
229 
231 {
232  WINDOW_THAWER thawer( m_parent );
233 
234  m_parent->GetCanvas()->Refresh();
235 }
236 
237 
238 void DIALOG_ERC::OnLeftClickMarkersList( wxHtmlLinkEvent& event )
239 {
240  wxString link = event.GetLinkInfo().GetHref();
241 
242  m_lastMarkerFound = nullptr;
243 
244  long index;
245 
246  if( !link.ToLong( &index ) )
247  return;
248 
249  const SCH_MARKER* marker = m_MarkersList->GetItem( index );
250 
251  if( !marker )
252  return;
253 
254  // Search for the selected marker
255  unsigned i;
256  SCH_SHEET_LIST sheetList( g_RootSheet );
257  bool found = false;
258 
259  for( i = 0; i < sheetList.size(); i++ )
260  {
261  for( auto aItem : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
262  {
263  if( static_cast<const SCH_MARKER*>( aItem ) == marker )
264  {
265  found = true;
266  break;
267  }
268  }
269 
270  if( found )
271  break;
272  }
273 
274  if( !found ) // Error
275  {
276  wxMessageBox( _( "Marker not found" ) );
277 
278  // The marker was deleted, so rebuild marker list
280  return;
281  }
282 
283  if( sheetList[i] != m_parent->GetCurrentSheet() )
284  {
287 
288  m_parent->SetCurrentSheet( sheetList[i] );
290  sheetList[i].LastScreen()->SetZoom( m_parent->GetScreen()->GetZoom() );
292  }
293 
294  m_lastMarkerFound = marker;
295  m_parent->FocusOnLocation( marker->m_Pos, true );
296  RedrawDrawPanel();
297 }
298 
299 
300 void DIALOG_ERC::OnLeftDblClickMarkersList( wxMouseEvent& event )
301 {
302  // Remember: OnLeftClickMarkersList was called just before and therefore m_lastMarkerFound
303  // was initialized (NULL if not found).
304  if( m_lastMarkerFound )
305  {
307  RedrawDrawPanel();
308  }
309 
310  Close();
311 }
312 
313 
315 {
316  // Try to know the size of bitmap button used in drc matrix
317  wxBitmapButton * dummy = new wxBitmapButton( m_matrixPanel, wxID_ANY, KiBitmap( ercerr_xpm ) );
318  wxSize bitmap_size = dummy->GetSize();
319  delete dummy;
320 
321  if( !m_diagErcTableInit )
322  {
323  memcpy( DiagErc, DefaultDiagErc, sizeof(DefaultDiagErc) );
324  m_diagErcTableInit = true;
325  }
326 
327  wxPoint pos;
328  // Get the current text size:use a dummy text.
329  wxStaticText* text = new wxStaticText( m_matrixPanel, -1, wxT( "W" ), pos );
330  int text_height = text->GetRect().GetHeight();
331  bitmap_size.y = std::max( bitmap_size.y, text_height );
332  delete text;
333 
334  // compute the Y pos interval:
335  pos.y = text_height;
336 
337  if( !m_initialized )
338  {
339  std::vector<wxStaticText*> labels;
340 
341  // Print row labels
342  for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
343  {
344  int y = pos.y + (ii * bitmap_size.y);
345  text = new wxStaticText( m_matrixPanel, -1, CommentERC_H[ii],
346  wxPoint( 5, y + ( bitmap_size.y / 2) - (text_height / 2) ) );
347  labels.push_back( text );
348 
349  int x = text->GetRect().GetRight();
350  pos.x = std::max( pos.x, x );
351  }
352 
353  // Right-align
354  for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
355  {
356  wxPoint labelPos = labels[ ii ]->GetPosition();
357  labelPos.x = pos.x - labels[ ii ]->GetRect().GetWidth();
358  labels[ ii ]->SetPosition( labelPos );
359  }
360 
361  pos.x += 5;
362  }
363  else
364  pos = m_buttonList[0][0]->GetPosition();
365 
366  for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
367  {
368  int y = pos.y + (ii * bitmap_size.y);
369 
370  for( int jj = 0; jj <= ii; jj++ )
371  {
372  // Add column labels (only once)
373  int diag = DiagErc[ii][jj];
374  int x = pos.x + (jj * bitmap_size.x);
375 
376  if( (ii == jj) && !m_initialized )
377  {
378  wxPoint txtpos;
379  txtpos.x = x + (bitmap_size.x / 2);
380  txtpos.y = y - text_height;
381  text = new wxStaticText( m_matrixPanel, -1, CommentERC_V[ii], txtpos );
382  }
383 
384  int event_id = ID_MATRIX_0 + ii + ( jj * ELECTRICAL_PINTYPES_TOTAL );
385  BITMAP_DEF bitmap_butt = erc_green_xpm;
386 
387  delete m_buttonList[ii][jj];
388  m_buttonList[ii][jj] = new wxBitmapButton( m_matrixPanel,
389  event_id,
390  KiBitmap( bitmap_butt ),
391  wxPoint( x, y ) );
392  setDRCMatrixButtonState( m_buttonList[ii][jj], diag );
393  }
394  }
395 
396  m_initialized = true;
397 }
398 
399 
400 void DIALOG_ERC::setDRCMatrixButtonState( wxBitmapButton *aButton, int aState )
401 {
402  BITMAP_DEF bitmap_butt = nullptr;
403  wxString tooltip;
404 
405  switch( aState )
406  {
407  case OK:
408  bitmap_butt = erc_green_xpm;
409  tooltip = _( "No error or warning" );
410  break;
411 
412  case WAR:
413  bitmap_butt = ercwarn_xpm;
414  tooltip = _( "Generate warning" );
415  break;
416 
417  case ERR:
418  bitmap_butt = ercerr_xpm;
419  tooltip = _( "Generate error" );
420  break;
421 
422  default:
423  break;
424  }
425 
426  if( bitmap_butt )
427  {
428  aButton->SetBitmap( KiBitmap( bitmap_butt ) );
429  aButton->SetToolTip( tooltip );
430  }
431 }
432 
433 
435 {
436  SCH_SHEET_LIST sheetList( g_RootSheet);
438 
439  for( unsigned i = 0; i < sheetList.size(); i++ )
440  {
441  for( auto aItem : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
442  {
443  SCH_MARKER* marker = static_cast<SCH_MARKER*>( aItem );
444 
445  if( marker->GetMarkerType() == MARKER_BASE::MARKER_ERC )
446  m_MarkersList->AppendToList( marker );
447  }
448  }
449 
451 }
452 
453 
454 void DIALOG_ERC::ResetDefaultERCDiag( wxCommandEvent& event )
455 {
456  memcpy( DiagErc, DefaultDiagErc, sizeof( DiagErc ) );
460 }
461 
462 
463 void DIALOG_ERC::ChangeErrorLevel( wxCommandEvent& event )
464 {
465  int id = event.GetId();
466  int ii = id - ID_MATRIX_0;
467  int x = ii / ELECTRICAL_PINTYPES_TOTAL;
468  int y = ii % ELECTRICAL_PINTYPES_TOTAL;
469  wxBitmapButton* butt = (wxBitmapButton*) event.GetEventObject();
470 
471  int level = ( DiagErc[y][x] + 1 ) % 3;
472 
473  setDRCMatrixButtonState( butt, level );
474 
475  DiagErc[y][x] = DiagErc[x][y] = level;
476 }
477 
478 
479 void DIALOG_ERC::TestErc( REPORTER& aReporter )
480 {
481  wxFileName fn;
482 
484 
485  // Build the whole sheet list in hierarchy (sheet, not screen)
486  SCH_SHEET_LIST sheets( g_RootSheet );
487  sheets.AnnotatePowerSymbols();
488 
489  if( m_parent->CheckAnnotate( aReporter, false ) )
490  {
491  if( aReporter.HasMessage() )
492  aReporter.ReportTail( _( "Annotation required!" ), REPORTER::RPT_ERROR );
493 
494  return;
495  }
496 
497  SCH_SCREENS screens;
498 
499  // Erase all previous DRC markers.
501 
502  // Test duplicate sheet names inside a given sheet. While one can have multiple references
503  // to the same file, each must have a unique name.
504  TestDuplicateSheetNames( true );
505 
507 
508  // The connection graph has a whole set of ERC checks it can run
511 
512  // Test is all units of each multiunit component have the same footprint assigned.
513  TestMultiunitFootprints( sheets );
514 
515  std::unique_ptr<NETLIST_OBJECT_LIST> objectsConnectedList( m_parent->BuildNetListBase() );
516 
517  // Reset the connection type indicator
518  objectsConnectedList->ResetConnectionsType();
519 
520  unsigned lastItemIdx = 0;
521  unsigned nextItemIdx = 0;
522  int MinConn = NOC;
523 
524  // Check that a pin appears in only one net. This check is necessary because multi-unit
525  // components that have shared pins could be wired to different nets.
526  std::unordered_map<wxString, wxString> pin_to_net_map;
527 
528  // The netlist generated by SCH_EDIT_FRAME::BuildNetListBase is sorted by net number, which
529  // means we can group netlist items into ranges that live in the same net. The range from
530  // nextItem to the current item (exclusive) needs to be checked against the current item.
531  // The lastItem variable is used as a helper to pass the last item's number from one loop
532  // iteration to the next, which simplifies the initial pass.
533  for( unsigned itemIdx = 0; itemIdx < objectsConnectedList->size(); itemIdx++ )
534  {
535  auto item = objectsConnectedList->GetItem( itemIdx );
536  auto lastItem = objectsConnectedList->GetItem( lastItemIdx );
537 
538  auto lastNet = lastItem->GetNet();
539  auto net = item->GetNet();
540 
541  wxASSERT_MSG( lastNet <= net, wxT( "Netlist not correctly ordered" ) );
542 
543  if( lastNet != net )
544  {
545  // New net found:
546  MinConn = NOC;
547  nextItemIdx = itemIdx;
548  }
549 
550  switch( item->m_Type )
551  {
552  // These items do not create erc problems
555  case NETLIST_ITEM::BUS:
557  case NETLIST_ITEM::LABEL:
561  break;
562 
563  // TODO(JE) Port this to the new system
564  case NETLIST_ITEM::PIN:
565  {
566  // Check if this pin has appeared before on a different net
567  if( item->m_Link )
568  {
569  auto ref = item->GetComponentParent()->GetRef( &item->m_SheetPath );
570  wxString pin_name = ref + "_" + item->m_PinNum;
571 
572  if( pin_to_net_map.count( pin_name ) == 0 )
573  {
574  pin_to_net_map[pin_name] = item->GetNetName();
575  }
576  else if( pin_to_net_map[pin_name] != item->GetNetName() )
577  {
578  SCH_MARKER* marker = new SCH_MARKER();
579 
580  marker->SetTimeStamp( GetNewTimeStamp() );
581  marker->SetData( ERCE_DIFFERENT_UNIT_NET, item->m_Start,
582  wxString::Format( _( "Pin %s on %s is connected to both %s and %s" ),
583  item->m_PinNum, ref, pin_to_net_map[pin_name], item->GetNetName() ),
584  item->m_Start );
587 
588  item->m_SheetPath.LastScreen()->Append( marker );
589  }
590  }
591 
592  // Look for ERC problems between pins:
593  TestOthersItems( objectsConnectedList.get(), itemIdx, nextItemIdx, &MinConn );
594  break;
595  }
596  default:
597  break;
598  }
599 
600  lastItemIdx = itemIdx;
601  }
602 
603  // Test similar labels (i;e. labels which are identical when
604  // using case insensitive comparisons)
606  objectsConnectedList->TestforSimilarLabels();
607 
608  // Displays global results:
609  updateMarkerCounts( &screens );
610 
611  // Display diags:
613 
614  // Display new markers from the current screen:
615  KIGFX::VIEW* view = m_parent->GetCanvas()->GetView();
616 
617  for( auto item : m_parent->GetScreen()->Items().OfType( SCH_MARKER_T ) )
618  view->Add( item );
619 
620  m_parent->GetCanvas()->Refresh();
621 
622  // Display message
623  aReporter.ReportTail( _( "Finished" ), REPORTER::RPT_INFO );
624 
626  {
627  fn = g_RootSheet->GetScreen()->GetFileName();
628  fn.SetExt( wxT( "erc" ) );
629 
630  wxFileDialog dlg( this, _( "ERC File" ), fn.GetPath(), fn.GetFullName(),
631  ErcFileWildcard(), wxFD_SAVE );
632 
633  if( dlg.ShowModal() == wxID_CANCEL )
634  return;
635 
636  if( WriteDiagnosticERC( GetUserUnits(), dlg.GetPath() ) )
637  ExecuteFile( this, Pgm().GetEditorName(), QuoteFullPath( fn ) );
638  }
639 }
640 
641 
642 wxDialog* InvokeDialogERC( SCH_EDIT_FRAME* aCaller )
643 {
644  // This is a modeless dialog, so new it rather than instantiating on stack.
645  DIALOG_ERC* dlg = new DIALOG_ERC( aCaller );
646 
647  dlg->Show( true );
648 
649  return dlg; // wxDialog is information hiding about DIALOG_ERC.
650 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
wxButton * m_ResetOptButton
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.
const wxString & GetFileName() const
Definition: sch_screen.h:157
EVT_COMMAND_RANGE(ID_MATRIX_0, ID_MATRIX_0+(ELECTRICAL_PINTYPES_TOTAL *ELECTRICAL_PINTYPES_TOTAL) - 1, wxEVT_COMMAND_BUTTON_CLICKED, DIALOG_ERC::ChangeErrorLevel) DIALOG_ERC
Definition: dialog_erc.cpp:62
wxTextCtrl * m_MessagesList
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: erc.h:43
NETLIST_OBJECT_LIST * BuildNetListBase(bool updateStatusText=true)
Create a flat list which stores all connected objects.
wxButton * m_buttondelmarkers
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:98
void DeleteAllMarkers(enum MARKER_BASE::TYPEMARKER aMarkerType)
Delete all electronic rules check markers of aMarkerType from all the screens in the list.
void setDRCMatrixButtonState(wxBitmapButton *aButton, int aState)
Definition: dialog_erc.cpp:400
virtual void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
PNG memory record (file in memory).
Definition: bitmap_def.h:29
This file is part of the common library TODO brief description.
bool check_unique_global_labels
If true, check to ensure that each global label apperas more than once.
Definition: erc_settings.h:67
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generates the connection data for the entire schematic hierarchy.
void Init()
Definition: dialog_erc.cpp:108
void transferSettingsToControls()
Definition: dialog_erc.cpp:139
int RunERC(const ERC_SETTINGS &aSettings, bool aCreateMarkers=true)
Runs electrical rule checks on the connectivity graph.
Class DIALOG_ERC_BASE.
const wxString CommentERC_V[]
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
Definition: base_screen.h:240
const wxString CommentERC_H[]
void OnEraseDrcMarkersClick(wxCommandEvent &event) override
Definition: dialog_erc.cpp:186
EE_TYPE OfType(KICAD_T aType)
Definition: sch_rtree.h:219
wxPoint m_Pos
position of the marker
Definition: marker_base.h:54
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
bool write_erc_file
If true, write ERC results to a file.
Definition: erc_settings.h:61
int DiagErc[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL]
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
wxCheckBox * m_cbCheckBusEntries
Schematic editor (Eeschema) main window.
wxTextCtrl * m_TotalErrCount
bool check_bus_to_bus_conflicts
If true, check that bus-to-bus connections share at least one member.
Definition: erc_settings.h:76
void DisplayCurrentSheet()
Draw the current sheet on the display.
Definition: hierarch.cpp:218
REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:61
CONNECTION_GRAPH * g_ConnectionGraph
This also wants to live in the eventual SCHEMATIC object.
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:278
#define ID_MATRIX_0
Definition: dialog_erc.cpp:58
ERC_HTML_LISTFRAME * m_MarkersList
void SaveProjectSettings(bool aAskForSave) override
Save changes to the project settings to the project (.pro) file.
WX_TEXT_CTRL_REPORTER is wrapper for reporting to a wxTextCtrl object.
Definition: reporter.h:144
EDA_UNITS GetUserUnits() const
Definition: dialog_shim.h:132
bool WriteDiagnosticERC(EDA_UNITS aUnits, const wxString &aFullFileName)
Function WriteDiagnosticERC save the ERC errors to aFullFileName.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void ChangeErrorLevel(wxCommandEvent &event)
Definition: dialog_erc.cpp:463
void OnLeftClickMarkersList(wxHtmlLinkEvent &event) override
Definition: dialog_erc.cpp:238
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
int DefaultDiagErc[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL]
Default Look up table which gives the ERC error level for a pair of connected pins Same as DiagErc,...
timestamp_t GetNewTimeStamp()
Definition: common.cpp:215
Definition: erc.h:44
bool m_initialized
Definition: dialog_erc.h:45
void OnErcCmpClick(wxCommandEvent &event) override
Definition: dialog_erc.cpp:217
#define NULL
wxCheckBox * m_cbCheckBusDriverConflicts
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)
Function ReportTail Places the report at the end of the list, for objects that support report orderin...
Definition: reporter.h:111
void RedrawDrawPanel()
Definition: dialog_erc.cpp:230
wxPanel * m_matrixPanel
wxBoxSizer * m_buttonsSizer
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
int TestDuplicateSheetNames(bool aCreateMarker)
Function TestDuplicateSheetNames( ) inside a given sheet, one cannot have sheets with duplicate names...
bool check_bus_to_net_conflicts
If true, check that bus wires don't graphically connect to net objects (or vice versa)
Definition: erc_settings.h:79
SCH_SHEET_PATH & GetCurrentSheet()
bool check_bus_driver_conflicts
If true, check that buses don't have conflicting drivers.
Definition: erc_settings.h:70
wxCheckBox * m_cbCheckBusToBusConflicts
void OnLeftDblClickMarkersList(wxMouseEvent &event) override
Definition: dialog_erc.cpp:300
Definition of file extensions used in Kicad.
void OnButtonCloseClick(wxCommandEvent &event) override
Definition: dialog_erc.cpp:199
wxNotebook * m_NoteBook
const BITMAP_OPAQUE ercerr_xpm[1]
Definition: ercerr.cpp:24
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:58
void AppendToList(SCH_MARKER *aMarker)
Function AppendToList.
const BITMAP_OPAQUE erc_green_xpm[1]
Definition: erc_green.cpp:24
void UpdateErcSettings(const ERC_SETTINGS &aSettings)
void SetMarkerType(enum TYPEMARKER aMarkerType)
accessors to set/get marker type (DRC, ERC, or other)
Definition: marker_base.h:181
wxTextCtrl * m_LastWarningCount
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:43
wxCheckBox * m_cbTestUniqueGlbLabels
bool Show(bool show) override
void OnCloseErcDialog(wxCloseEvent &event) override
Definition: dialog_erc.cpp:205
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...
void OnUpdateUI(wxUpdateUIEvent &event) override
Definition: dialog_erc.cpp:131
int CheckAnnotate(REPORTER &aReporter, bool aOneSheetOnly)
Check for annotation errors.
int GetMarkerCount(enum MARKER_BASE::TYPEMARKER aMarkerType, enum MARKER_BASE::MARKER_SEVERITY aSeverity)
Return the number of ERC markers of aMarkerType from all of the screens in the list.
void LoadDefaults()
Definition: erc_settings.h:33
ERC_SETTINGS m_settings
Definition: dialog_erc.h:48
void ClearList()
Function ClearList deletes all items shown in the list.
const ERC_SETTINGS & GetErcSettings()
eeschema ERC modeless dialog ID
Definition: id.h:223
wxString ErcFileWildcard()
static bool m_diagErcTableInit
Definition: dialog_erc.h:47
#define NOC
Definition: erc.h:82
void FocusOnLocation(const wxPoint &aPos, bool aCenterView=false)
Useful to focus on a particular location, in find functions Move the graphic cursor (crosshair cursor...
see class PGM_BASE
const SCH_MARKER * GetItem(unsigned aIndex)
Function GetItem returns a requested DRC_ITEM* or NULL.
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 to draw a dummy shape when a LIB_PART is not found in library.
enum TYPEMARKER GetMarkerType() const
Definition: marker_base.h:186
wxString QuoteFullPath(wxFileName &fn, wxPathFormat format)
Quote return value of wxFileName::GetFullPath().
Definition: gestfich.cpp:378
#define _(s)
Definition: 3d_actions.cpp:31
void SetErrorLevel(MARKER_SEVERITY aErrorLevel)
accessors to set/get error levels (warning, error, fatal error..)
Definition: marker_base.h:169
void OnResetMatrixClick(wxCommandEvent &event) override
Definition: dialog_erc.cpp:211
EE_RTREE & Items()
Definition: sch_screen.h:127
void transferControlsToSettings()
Definition: dialog_erc.cpp:151
bool check_bus_entry_conflicts
If true, check that wires connecting to buses actually exist in the bus.
Definition: erc_settings.h:73
void DisplayList(EDA_UNITS aUnits)
Function DisplayList(); Build the Html marker list and show it.
void updateMarkerCounts(SCH_SCREENS *screens)
Definition: dialog_erc.cpp:163
int TestConflictingBusAliases(bool aCreateMarker)
Checks that there are not conflicting bus alias definitions in the schematic.
wxCheckBox * m_WriteResultOpt
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...
bool check_similar_labels
If true, check each sheet for labels that differ only by letter case.
Definition: erc_settings.h:64
const BITMAP_OPAQUE ercwarn_xpm[1]
Definition: ercwarn.cpp:68
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:127
SCH_SHEET * g_RootSheet
#define ELECTRICAL_PINTYPES_TOTAL
Definition: pin_type.h:54
void SetData(EDA_UNITS aUnits, int aErrorCode, const wxPoint &aMarkerPos, EDA_ITEM *aItem, const wxPoint &aPos, EDA_ITEM *bItem=nullptr, const wxPoint &bPos=wxPoint())
Function SetData fills in all the reportable data associated with a MARKER.
VIEW.
Definition: view.h:61
void ReBuildMatrixPanel()
Definition: dialog_erc.cpp:314
void TestErc(REPORTER &aReporter)
Definition: dialog_erc.cpp:479
wxTextCtrl * m_LastErrCount
Definition of the NETLIST_OBJECT class.
int TestMultiunitFootprints(SCH_SHEET_LIST &aSheetList)
Test if all units of each multiunit component have the same footprint assigned.
void ResetDefaultERCDiag(wxCommandEvent &event)
Definition: dialog_erc.cpp:454
int ExecuteFile(wxWindow *frame, const wxString &ExecFile, const wxString &param, wxProcess *callback)
Function ExecuteFile calls the executable file ExecFile with the command line parameters param.
Definition: gestfich.cpp:174
wxBitmapButton * m_buttonList[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL]
Definition: dialog_erc.h:44
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:642
const SCH_MARKER * m_lastMarkerFound
Definition: dialog_erc.h:46
wxCheckBox * m_cbCheckBusToNetConflicts
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:498
void DisplayERC_MarkersList()
Definition: dialog_erc.cpp:434
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:212
wxCheckBox * m_cbTestSimilarLabels