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-2017 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 
31 #include <fctsys.h>
32 #include <sch_draw_panel.h>
33 #include <kicad_string.h>
34 #include <gestfich.h>
35 #include <pgm_base.h>
36 #include <sch_screen.h>
37 #include <sch_edit_frame.h>
38 #include <invoke_sch_dialog.h>
39 #include <project.h>
40 #include <kiface_i.h>
41 #include <bitmaps.h>
42 #include <reporter.h>
44 #include <sch_view.h>
45 #include <netlist.h>
46 #include <netlist_object.h>
47 #include <sch_marker.h>
48 #include <sch_sheet.h>
49 #include <lib_pin.h>
50 #include <sch_component.h>
51 
52 #include <dialog_erc.h>
53 #include <erc.h>
54 #include <id.h>
55 
56 
59 
60 
61 bool DIALOG_ERC::m_writeErcFile = false; // saved only for the current session
62 bool DIALOG_ERC::m_TestSimilarLabels = true; // Save in project config
63 bool DIALOG_ERC::m_diagErcTableInit = false; // saved only for the current session
64 bool DIALOG_ERC::m_tstUniqueGlobalLabels = true; // saved only for the current session
65 
66 // Control identifiers for events
67 #define ID_MATRIX_0 1800
68 
69 
70 BEGIN_EVENT_TABLE( DIALOG_ERC, DIALOG_ERC_BASE )
72  wxEVT_COMMAND_BUTTON_CLICKED, DIALOG_ERC::ChangeErrorLevel )
73 END_EVENT_TABLE()
74 
75 
77  DIALOG_ERC_BASE( parent, ID_DIALOG_ERC // parent looks for this ID explicitly
78  )
79 {
80  m_parent = parent;
81  m_lastMarkerFound = NULL;
82 
83  wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
84  infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
85  m_textMarkers->SetFont( infoFont );
86  m_titleMessages->SetFont( infoFont );
87 
88  Init();
89 
90  // We use a sdbSizer to get platform-dependent ordering of the action buttons, but
91  // that requires us to correct the button labels here.
92  m_sdbSizer1OK->SetLabel( _( "Run" ) );
93  m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
94  m_sdbSizer1->Layout();
95 
96  m_sdbSizer1OK->SetDefault();
97 
98  // Now all widgets have the size fixed, call FinishDialogSettings
99  FinishDialogSettings();
100 }
101 
102 
104 {
107 }
108 
109 
111 {
112  m_initialized = false;
113 
114  for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
115  {
116  for( int jj = 0; jj < PINTYPE_COUNT; jj++ )
117  m_buttonList[ii][jj] = NULL;
118  }
119 
120  m_WriteResultOpt->SetValue( m_writeErcFile );
123 
124  SCH_SCREENS screens;
125  updateMarkerCounts( &screens );
126 
128 
129  // Init Panel Matrix
131 }
132 
133 
135 {
136  int markers = screens->GetMarkerCount( MARKER_BASE::MARKER_ERC,
138  int warnings = screens->GetMarkerCount( MARKER_BASE::MARKER_ERC,
140  int errors = screens->GetMarkerCount( MARKER_BASE::MARKER_ERC,
142 
143  wxString num;
144  num.Printf( wxT( "%d" ), markers );
145  m_TotalErrCount->SetValue( num );
146 
147  num.Printf( wxT( "%d" ), errors );
148  m_LastErrCount->SetValue( num );
149 
150  num.Printf( wxT( "%d" ), warnings );
151  m_LastWarningCount->SetValue( num );
152 }
153 
154 
155 /* Delete the old ERC markers, over the whole hierarchy
156  */
157 void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event )
158 {
159  SCH_SCREENS ScreenList;
160 
162  updateMarkerCounts( &ScreenList );
163 
165  m_parent->GetCanvas()->Refresh();
166 }
167 
168 
169 // This is a modeless dialog so we have to handle these ourselves.
170 void DIALOG_ERC::OnButtonCloseClick( wxCommandEvent& event )
171 {
172  Close();
173 }
174 
175 
176 void DIALOG_ERC::OnCloseErcDialog( wxCloseEvent& event )
177 {
178  Destroy();
179 }
180 
181 
182 void DIALOG_ERC::OnResetMatrixClick( wxCommandEvent& event )
183 {
184  ResetDefaultERCDiag( event );
185 }
186 
187 
188 void DIALOG_ERC::OnErcCmpClick( wxCommandEvent& event )
189 {
190  wxBusyCursor();
192 
193  m_MessagesList->Clear();
194  wxSafeYield(); // m_MarkersList must be redraw
195 
197  TestErc( reporter );
198 }
199 
200 
202 {
203  WINDOW_THAWER thawer( m_parent );
204 
205  m_parent->GetCanvas()->Refresh();
206 }
207 
208 
209 void DIALOG_ERC::OnLeftClickMarkersList( wxHtmlLinkEvent& event )
210 {
211  wxString link = event.GetLinkInfo().GetHref();
212 
213  m_lastMarkerFound = NULL;
214 
215  long index;
216 
217  if( !link.ToLong( &index ) )
218  return;
219 
220  const SCH_MARKER* marker = m_MarkersList->GetItem( index );
221 
222  if( marker == NULL )
223  return;
224 
225  // Search for the selected marker
226  unsigned i;
227  SCH_SHEET_LIST sheetList( g_RootSheet );
228  bool notFound = true;
229 
230  for( i = 0; i < sheetList.size(); i++ )
231  {
232  SCH_ITEM* item = (SCH_ITEM*) sheetList[i].LastDrawList();
233 
234  for( ; item; item = item->Next() )
235  {
236  if( item == marker )
237  {
238  notFound = false;
239  break;
240  }
241  }
242 
243  if( notFound == false )
244  break;
245  }
246 
247  if( notFound ) // Error
248  {
249  wxMessageBox( _( "Marker not found" ) );
250 
251  // The marker was deleted, so rebuild marker list
253  return;
254  }
255 
256  if( sheetList[i] != m_parent->GetCurrentSheet() )
257  {
258  sheetList[i].LastScreen()->SetZoom( m_parent->GetScreen()->GetZoom() );
259  m_parent->SetCurrentSheet( sheetList[i] );
261  }
262 
263  m_lastMarkerFound = marker;
264  m_parent->FocusOnLocation( marker->m_Pos, false, true );
265  m_parent->SetCrossHairPosition( marker->m_Pos );
266  RedrawDrawPanel();
267 }
268 
269 
270 void DIALOG_ERC::OnLeftDblClickMarkersList( wxMouseEvent& event )
271 {
272  // Remember: OnLeftClickMarkersList was called just before
273  // and therefore m_lastMarkerFound was initialized.
274  // (NULL if not found)
275  if( m_lastMarkerFound )
276  {
279  RedrawDrawPanel();
280  // prevent a mouse left button release event in
281  // coming from the ERC dialog double click
282  // ( the button is released after closing this dialog and will generate
283  // an unwanted event in parent frame)
285  }
286 
287  Close();
288 }
289 
290 
292 {
293  // Try to know the size of bitmap button used in drc matrix
294  wxBitmapButton * dummy = new wxBitmapButton( m_matrixPanel, wxID_ANY, KiBitmap( ercerr_xpm ) );
295  wxSize bitmap_size = dummy->GetSize();
296  delete dummy;
297 
298  if( !m_diagErcTableInit )
299  {
300  memcpy( DiagErc, DefaultDiagErc, sizeof(DefaultDiagErc) );
301  m_diagErcTableInit = true;
302  }
303 
304  wxPoint pos;
305  // Get the current text size:use a dummy text.
306  wxStaticText* text = new wxStaticText( m_matrixPanel, -1, wxT( "W" ), pos );
307  int text_height = text->GetRect().GetHeight();
308  bitmap_size.y = std::max( bitmap_size.y, text_height );
309  delete text;
310 
311  // compute the Y pos interval:
312  pos.y = text_height;
313 
314  if( m_initialized == false )
315  {
316  std::vector<wxStaticText*> labels;
317 
318  // Print row labels
319  for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
320  {
321  int y = pos.y + (ii * bitmap_size.y);
322  text = new wxStaticText( m_matrixPanel, -1, CommentERC_H[ii],
323  wxPoint( 5, y + ( bitmap_size.y / 2) - (text_height / 2) ) );
324  labels.push_back( text );
325 
326  int x = text->GetRect().GetRight();
327  pos.x = std::max( pos.x, x );
328  }
329 
330  // Right-align
331  for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
332  {
333  wxPoint labelPos = labels[ ii ]->GetPosition();
334  labelPos.x = pos.x - labels[ ii ]->GetRect().GetWidth();
335  labels[ ii ]->SetPosition( labelPos );
336  }
337 
338  pos.x += 5;
339  }
340  else
341  pos = m_buttonList[0][0]->GetPosition();
342 
343  for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
344  {
345  int y = pos.y + (ii * bitmap_size.y);
346 
347  for( int jj = 0; jj <= ii; jj++ )
348  {
349  // Add column labels (only once)
350  int diag = DiagErc[ii][jj];
351  int x = pos.x + (jj * bitmap_size.x);
352 
353  if( (ii == jj) && !m_initialized )
354  {
355  wxPoint txtpos;
356  txtpos.x = x + (bitmap_size.x / 2);
357  txtpos.y = y - text_height;
358  text = new wxStaticText( m_matrixPanel, -1, CommentERC_V[ii], txtpos );
359  }
360 
361  int event_id = ID_MATRIX_0 + ii + ( jj * PINTYPE_COUNT );
362  BITMAP_DEF bitmap_butt = erc_green_xpm;
363 
364  delete m_buttonList[ii][jj];
365  m_buttonList[ii][jj] = new wxBitmapButton( m_matrixPanel,
366  event_id,
367  KiBitmap( bitmap_butt ),
368  wxPoint( x, y ) );
369  setDRCMatrixButtonState( m_buttonList[ii][jj], diag );
370  }
371  }
372 
373  m_initialized = true;
374 }
375 
376 
377 void DIALOG_ERC::setDRCMatrixButtonState( wxBitmapButton *aButton, int aState )
378 {
379  BITMAP_DEF bitmap_butt = NULL;
380  wxString tooltip;
381 
382  switch( aState )
383  {
384  case OK:
385  bitmap_butt = erc_green_xpm;
386  tooltip = _( "No error or warning" );
387  break;
388 
389  case WAR:
390  bitmap_butt = ercwarn_xpm;
391  tooltip = _( "Generate warning" );
392  break;
393 
394  case ERR:
395  bitmap_butt = ercerr_xpm;
396  tooltip = _( "Generate error" );
397  break;
398  }
399 
400  if( bitmap_butt )
401  {
402  aButton->SetBitmap( KiBitmap( bitmap_butt ) );
403  aButton->SetToolTip( tooltip );
404  }
405 }
406 
407 
409 {
410  SCH_SHEET_LIST sheetList( g_RootSheet);
412 
413  for( unsigned i = 0; i < sheetList.size(); i++ )
414  {
415  SCH_ITEM* item = sheetList[i].LastDrawList();
416 
417  for( ; item != NULL; item = item->Next() )
418  {
419  if( item->Type() != SCH_MARKER_T )
420  continue;
421 
422  SCH_MARKER* marker = (SCH_MARKER*) item;
423 
424  if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
425  continue;
426 
427  m_MarkersList->AppendToList( marker );
428  }
429  }
430 
432 }
433 
434 
435 void DIALOG_ERC::ResetDefaultERCDiag( wxCommandEvent& event )
436 {
437  memcpy( DiagErc, DefaultDiagErc, sizeof( DiagErc ) );
439  m_TestSimilarLabels = true;
443 }
444 
445 
446 void DIALOG_ERC::ChangeErrorLevel( wxCommandEvent& event )
447 {
448  int id, level, ii, x, y;
449  wxPoint pos;
450 
451  id = event.GetId();
452  ii = id - ID_MATRIX_0;
453  wxBitmapButton* butt = (wxBitmapButton*) event.GetEventObject();
454  pos = butt->GetPosition();
455 
456  x = ii / PINTYPE_COUNT; y = ii % PINTYPE_COUNT;
457 
458  level = DiagErc[y][x];
459 
460  //change to the next error level
461  switch( level )
462  {
463  case OK:
464  level = WAR;
465  break;
466 
467  case WAR:
468  level = ERR;
469  break;
470 
471  case ERR:
472  level = OK;
473  break;
474  }
475 
476  setDRCMatrixButtonState( butt, level );
477 
478  DiagErc[y][x] = DiagErc[x][y] = level;
479 }
480 
481 
482 void DIALOG_ERC::TestErc( REPORTER& aReporter )
483 {
484  wxFileName fn;
485 
486  m_writeErcFile = m_WriteResultOpt->GetValue();
489 
490  // Build the whole sheet list in hierarchy (sheet, not screen)
491  SCH_SHEET_LIST sheets( g_RootSheet );
492  sheets.AnnotatePowerSymbols();
493 
494  if( m_parent->CheckAnnotate( aReporter, false ) )
495  {
496  if( aReporter.HasMessage() )
497  aReporter.ReportTail( _( "Annotation required!" ), REPORTER::RPT_ERROR );
498 
499  return;
500  }
501 
502  SCH_SCREENS screens;
503 
504  // Erase all previous DRC markers.
506 
507  /* Test duplicate sheet names inside a given sheet, one cannot have sheets with
508  * duplicate names (file names can be duplicated).
509  */
510  TestDuplicateSheetNames( true );
511 
512  /* Test is all units of each multiunit component have the same footprint assigned.
513  */
514  TestMultiunitFootprints( sheets );
515 
516  std::unique_ptr<NETLIST_OBJECT_LIST> objectsConnectedList( m_parent->BuildNetListBase() );
517 
518  // Reset the connection type indicator
519  objectsConnectedList->ResetConnectionsType();
520 
521  unsigned lastItemIdx;
522  unsigned nextItemIdx = lastItemIdx = 0;
523  int MinConn = NOC;
524 
525  /* Check that a pin appears in only one net. This check is necessary
526  * because multi-unit components that have shared pins can be wired to
527  * different nets.
528  */
529  std::unordered_map<wxString, wxString> pin_to_net_map;
530 
531  /* The netlist generated by SCH_EDIT_FRAME::BuildNetListBase is sorted
532  * by net number, which means we can group netlist items into ranges
533  * that live in the same net. The range from nextItem to the current
534  * item (exclusive) needs to be checked against the current item. The
535  * lastItem variable is used as a helper to pass the last item's number
536  * from one loop iteration to the next, which simplifies the initial
537  * pass.
538  */
539 
540  for( unsigned itemIdx = 0; itemIdx < objectsConnectedList->size(); itemIdx++ )
541  {
542  auto item = objectsConnectedList->GetItem( itemIdx );
543  auto lastItem = objectsConnectedList->GetItem( lastItemIdx );
544 
545  auto lastNet = lastItem->GetNet();
546  auto net = item->GetNet();
547 
548  wxASSERT_MSG( lastNet <= net, wxT( "Netlist not correctly ordered" ) );
549 
550  if( lastNet != net )
551  {
552  // New net found:
553  MinConn = NOC;
554  nextItemIdx = itemIdx;
555  }
556 
557  switch( item->m_Type )
558  {
559  // These items do not create erc problems
561  case NET_SEGMENT:
562  case NET_BUS:
563  case NET_JUNCTION:
564  case NET_LABEL:
565  case NET_BUSLABELMEMBER:
566  case NET_PINLABEL:
568  break;
569 
570  case NET_HIERLABEL:
572  case NET_SHEETLABEL:
574  // ERC problems when pin sheets do not match hierarchical labels.
575  // Each pin sheet must match a hierarchical label
576  // Each hierarchical label must match a pin sheet
577  objectsConnectedList->TestforNonOrphanLabel( itemIdx, nextItemIdx );
578  break;
579  case NET_GLOBLABEL:
581  objectsConnectedList->TestforNonOrphanLabel( itemIdx, nextItemIdx );
582  break;
583 
584  case NET_NOCONNECT:
585 
586  // ERC problems when a noconnect symbol is connected to more than one pin.
587  MinConn = NET_NC;
588 
589  if( objectsConnectedList->CountPinsInNet( nextItemIdx ) > 1 )
590  Diagnose( item, NULL, MinConn, UNC );
591 
592  break;
593 
594  case NET_PIN:
595  {
596  // Check if this pin has appeared before on a different net
597  if( item->m_Link )
598  {
599  auto ref = item->GetComponentParent()->GetRef( &item->m_SheetPath );
600  wxString pin_name = ref + "_" + item->m_PinNum;
601 
602  if( pin_to_net_map.count( pin_name ) == 0 )
603  {
604  pin_to_net_map[pin_name] = item->GetNetName();
605  }
606  else if( pin_to_net_map[pin_name] != item->GetNetName() )
607  {
608  SCH_MARKER* marker = new SCH_MARKER();
609 
610  marker->SetTimeStamp( GetNewTimeStamp() );
611  marker->SetData( ERCE_DIFFERENT_UNIT_NET, item->m_Start,
612  wxString::Format( _( "Pin %s on %s is connected to both %s and %s" ),
613  item->m_PinNum, ref, pin_to_net_map[pin_name], item->GetNetName() ),
614  item->m_Start );
617 
618  item->m_SheetPath.LastScreen()->Append( marker );
619  }
620  }
621 
622  // Look for ERC problems between pins:
623  TestOthersItems( objectsConnectedList.get(), itemIdx, nextItemIdx, &MinConn );
624  break;
625  }
626  }
627 
628  lastItemIdx = itemIdx;
629  }
630 
631  // Test similar labels (i;e. labels which are identical when
632  // using case insensitive comparisons)
633  if( m_TestSimilarLabels )
634  objectsConnectedList->TestforSimilarLabels();
635 
636  // Displays global results:
637  updateMarkerCounts( &screens );
638 
639  // Display diags:
641 
642  // Display new markers from the current screen:
643  KIGFX::VIEW* view = m_parent->GetCanvas()->GetView();
644 
645  for( auto item = m_parent->GetScreen()->GetDrawItems(); item; item = item->Next() )
646  {
647  if( item->Type() == SCH_MARKER_T )
648  view->Add( item );
649  }
650 
651  m_parent->GetCanvas()->Refresh();
652 
653  // Display message
654  aReporter.ReportTail( _( "Finished" ), REPORTER::RPT_INFO );
655 
656  if( m_writeErcFile )
657  {
658  fn = g_RootSheet->GetScreen()->GetFileName();
659  fn.SetExt( wxT( "erc" ) );
660 
661  wxFileDialog dlg( this, _( "ERC File" ), fn.GetPath(), fn.GetFullName(),
662  ErcFileWildcard(), wxFD_SAVE );
663 
664  if( dlg.ShowModal() == wxID_CANCEL )
665  return;
666 
667  if( WriteDiagnosticERC( GetUserUnits(), dlg.GetPath() ) )
668  ExecuteFile( this, Pgm().GetEditorName(), QuoteFullPath( fn ) );
669  }
670 }
671 
672 
673 wxDialog* InvokeDialogERC( SCH_EDIT_FRAME* aCaller )
674 {
675  // This is a modeless dialog, so new it rather than instantiating on stack.
676  DIALOG_ERC* dlg = new DIALOG_ERC( aCaller );
677 
678  dlg->Show( true );
679 
680  return dlg; // wxDialog is information hiding about DIALOG_ERC.
681 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Definition of the SCH_SHEET class for Eeschema.
Class SCH_SHEET_LIST.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
virtual bool HasMessage() const =0
Function HasMessage Returns true if the reporter client is non-empty.
static bool m_TestSimilarLabels
Definition: dialog_erc.h:51
wxTextCtrl * m_MessagesList
Definition: erc.h:43
NETLIST_OBJECT_LIST * BuildNetListBase(bool updateStatusText=true)
Create a flat list which stores all connected objects.
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:377
void DisplayList(EDA_UNITS_T aUnits)
Function DisplayList(); Build the Html marker list and show it.
PNG memory record (file in memory).
Definition: bitmap_types.h:43
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...
Definition: erc.cpp:430
static bool m_writeErcFile
Definition: dialog_erc.h:46
This file is part of the common library TODO brief description.
void Init()
Definition: dialog_erc.cpp:110
Class DIALOG_ERC_BASE.
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
Definition: base_screen.h:340
void OnEraseDrcMarkersClick(wxCommandEvent &event) override
Definition: dialog_erc.cpp:157
const wxString CommentERC_H[]
Definition: erc.cpp:87
const wxString & GetFileName() const
Definition: sch_screen.h:131
wxPoint m_Pos
position of the marker
Definition: marker_base.h:54
void SetData(EDA_UNITS_T 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.
int DefaultDiagErc[PINTYPE_COUNT][PINTYPE_COUNT]
Default Look up table which gives the ERC error level for a pair of connected pins Same as DiagErc...
Definition: erc.cpp:133
void Diagnose(NETLIST_OBJECT *aNetItemRef, NETLIST_OBJECT *aNetItemTst, int aMinConn, int aDiag)
Performs ERC testing and creates an ERC marker to show the ERC problem for aNetItemRef or between aNe...
Definition: erc.cpp:294
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
Schematic editor (Eeschema) main window.
wxTextCtrl * m_TotalErrCount
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 SkipNextLeftButtonReleaseEvent()
After calling this function, if the left mouse button is down, the next left mouse button release eve...
Class REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:61
void UpdateAllScreenReferences()
Function UpdateAllScreenReferences updates the reference and the m_Multi parameter (part selection) f...
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...
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:279
SCH_ITEM * Next() const
bool WriteDiagnosticERC(EDA_UNITS_T aUnits, const wxString &aFullFileName)
Function WriteDiagnosticERC save the ERC errors to aFullFileName.
Definition: erc.cpp:583
#define ID_MATRIX_0
Definition: dialog_erc.cpp:67
ERC_HTML_LISTFRAME * m_MarkersList
#define ERCE_DIFFERENT_UNIT_NET
Definition: erc.h:65
Class WX_TEXT_CTRL_REPORTER is wrapper for reporting to a wxTextCtrl object.
Definition: reporter.h:142
enum TYPEMARKER GetMarkerType() const
Definition: marker_base.h:164
Definition: erc.h:42
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:446
void OnLeftClickMarkersList(wxHtmlLinkEvent &event) override
Definition: dialog_erc.cpp:209
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
timestamp_t GetNewTimeStamp()
Definition: common.cpp:212
Definition: erc.h:44
bool m_initialized
Definition: dialog_erc.h:44
void OnErcCmpClick(wxCommandEvent &event) override
Definition: dialog_erc.cpp:188
int TestDuplicateSheetNames(bool aCreateMarker)
Function TestDuplicateSheetNames( ) inside a given sheet, one cannot have sheets with duplicate names...
Definition: erc.cpp:177
wxBitmapButton * m_buttonList[PINTYPE_COUNT][PINTYPE_COUNT]
Definition: dialog_erc.h:43
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:56
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:109
void RedrawDrawPanel()
Definition: dialog_erc.cpp:201
wxPanel * m_matrixPanel
SCH_DRAW_PANEL * GetCanvas() const override
SCH_SHEET_PATH & GetCurrentSheet()
void OnLeftDblClickMarkersList(wxMouseEvent &event) override
Definition: dialog_erc.cpp:270
The common library.
DIALOG_ERC(SCH_EDIT_FRAME *parent)
void OnButtonCloseClick(wxCommandEvent &event) override
Definition: dialog_erc.cpp:170
Definition: erc.h:45
void AppendToList(SCH_MARKER *aMarker)
Function AppendToList.
void SetMarkerType(enum TYPEMARKER aMarkerType)
accessors to set/get marker type (DRC, ERC, or other)
Definition: marker_base.h:159
KIGFX::SCH_VIEW * GetView() const
wxTextCtrl * m_LastWarningCount
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:42
wxCheckBox * m_cbTestUniqueGlbLabels
bool Show(bool show) override
void OnCloseErcDialog(wxCloseEvent &event) override
Definition: dialog_erc.cpp:176
int CheckAnnotate(REPORTER &aReporter, bool aOneSheetOnly)
Check for annotation errors.
Definition: annotate.cpp:245
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.
int DiagErc[PINTYPE_COUNT][PINTYPE_COUNT]
Definition: erc.cpp:124
Definitions for the Eeschema program SCH_SCREEN class.
void ClearList()
Function ClearList deletes all items shown in the list.
eeschema ERC modeless dialog ID
Definition: id.h:284
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:160
wxString ErcFileWildcard()
Definition the SCH_COMPONENT class for Eeschema.
static bool m_diagErcTableInit
Definition: dialog_erc.h:47
#define NOC
Definition: erc.h:73
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 when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
#define max(a, b)
Definition: auxiliary.h:86
wxString QuoteFullPath(wxFileName &fn, wxPathFormat format)
Quote return value of wxFileName::GetFullPath().
Definition: gestfich.cpp:417
void SetErrorLevel(MARKER_SEVERITY aErrorLevel)
accessors to set/get error levels (warning, error, fatal error..)
Definition: marker_base.h:147
void OnResetMatrixClick(wxCommandEvent &event) override
Definition: dialog_erc.cpp:182
size_t i
Definition: json11.cpp:597
void updateMarkerCounts(SCH_SCREENS *screens)
Definition: dialog_erc.cpp:134
static bool m_tstUniqueGlobalLabels
Definition: dialog_erc.h:48
wxCheckBox * m_WriteResultOpt
const wxString CommentERC_V[]
Definition: erc.cpp:103
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:344
EVT_COMMAND_RANGE(ID_MATRIX_0, ID_MATRIX_0+(PINTYPE_COUNT *PINTYPE_COUNT)-1, wxEVT_COMMAND_BUTTON_CLICKED, DIALOG_ERC::ChangeErrorLevel) DIALOG_ERC
Definition: dialog_erc.cpp:71
#define NET_NC
Definition: erc.h:71
Class VIEW.
Definition: view.h:61
void ReBuildMatrixPanel()
Definition: dialog_erc.cpp:291
void TestErc(REPORTER &aReporter)
Definition: dialog_erc.cpp:482
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
wxTextCtrl * m_LastErrCount
Definition of the NETLIST_OBJECT class.
void ResetDefaultERCDiag(wxCommandEvent &event)
Definition: dialog_erc.cpp:435
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:208
int TestMultiunitFootprints(SCH_SHEET_LIST &aSheetList)
Test if all units of each multiunit component have the same footprint assigned.
Definition: erc.cpp:228
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
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:673
const SCH_MARKER * m_lastMarkerFound
Definition: dialog_erc.h:45
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:523
void DisplayERC_MarkersList()
Definition: dialog_erc.cpp:408
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:206
wxCheckBox * m_cbTestSimilarLabels
EDA_UNITS_T GetUserUnits() const override
Definition: dialog_shim.h:132