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 #include <connection_graph.h>
52 
53 #include <dialog_erc.h>
54 #include <erc.h>
55 #include <id.h>
56 
57 
60 
61 
62 bool DIALOG_ERC::m_diagErcTableInit = false; // saved only for the current session
63 
64 // Control identifiers for events
65 #define ID_MATRIX_0 1800
66 
67 
68 BEGIN_EVENT_TABLE( DIALOG_ERC, DIALOG_ERC_BASE )
70  wxEVT_COMMAND_BUTTON_CLICKED, DIALOG_ERC::ChangeErrorLevel )
71 END_EVENT_TABLE()
72 
73 
75  DIALOG_ERC_BASE( parent, ID_DIALOG_ERC // parent looks for this ID explicitly
76  )
77 {
78  m_parent = parent;
79  m_lastMarkerFound = NULL;
80 
81  wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
82  infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
83  m_textMarkers->SetFont( infoFont );
84  m_titleMessages->SetFont( infoFont );
85 
86  Init();
87 
88  // We use a sdbSizer to get platform-dependent ordering of the action buttons, but
89  // that requires us to correct the button labels here.
90  m_sdbSizer1OK->SetLabel( _( "Run" ) );
91  m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
92  m_sdbSizer1->Layout();
93 
94  m_sdbSizer1OK->SetDefault();
95 
96  // Now all widgets have the size fixed, call FinishDialogSettings
97  FinishDialogSettings();
98 }
99 
100 
102 {
104 
106  {
108  m_parent->SaveProjectSettings( false );
109  }
110 }
111 
112 
114 {
115  m_initialized = false;
116 
117  for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
118  {
119  for( int jj = 0; jj < PINTYPE_COUNT; jj++ )
120  m_buttonList[ii][jj] = NULL;
121  }
122 
125 
126  SCH_SCREENS screens;
127  updateMarkerCounts( &screens );
128 
130 
131  // Init Panel Matrix
133 }
134 
135 
137 {
145 }
146 
147 
149 {
157 }
158 
159 
161 {
162  int markers = screens->GetMarkerCount( MARKER_BASE::MARKER_ERC,
164  int warnings = screens->GetMarkerCount( MARKER_BASE::MARKER_ERC,
166  int errors = screens->GetMarkerCount( MARKER_BASE::MARKER_ERC,
168 
169  wxString num;
170  num.Printf( wxT( "%d" ), markers );
171  m_TotalErrCount->SetValue( num );
172 
173  num.Printf( wxT( "%d" ), errors );
174  m_LastErrCount->SetValue( num );
175 
176  num.Printf( wxT( "%d" ), warnings );
177  m_LastWarningCount->SetValue( num );
178 }
179 
180 
181 /* Delete the old ERC markers, over the whole hierarchy
182  */
183 void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event )
184 {
185  SCH_SCREENS ScreenList;
186 
188  updateMarkerCounts( &ScreenList );
189 
191  m_parent->GetCanvas()->Refresh();
192 }
193 
194 
195 // This is a modeless dialog so we have to handle these ourselves.
196 void DIALOG_ERC::OnButtonCloseClick( wxCommandEvent& event )
197 {
198  Close();
199 }
200 
201 
202 void DIALOG_ERC::OnCloseErcDialog( wxCloseEvent& event )
203 {
204  Destroy();
205 }
206 
207 
208 void DIALOG_ERC::OnResetMatrixClick( wxCommandEvent& event )
209 {
210  ResetDefaultERCDiag( event );
211 }
212 
213 
214 void DIALOG_ERC::OnErcCmpClick( wxCommandEvent& event )
215 {
216  wxBusyCursor();
218 
219  m_MessagesList->Clear();
220  wxSafeYield(); // m_MarkersList must be redraw
221 
223  TestErc( reporter );
224 }
225 
226 
228 {
229  WINDOW_THAWER thawer( m_parent );
230 
231  m_parent->GetCanvas()->Refresh();
232 }
233 
234 
235 void DIALOG_ERC::OnLeftClickMarkersList( wxHtmlLinkEvent& event )
236 {
237  wxString link = event.GetLinkInfo().GetHref();
238 
239  m_lastMarkerFound = NULL;
240 
241  long index;
242 
243  if( !link.ToLong( &index ) )
244  return;
245 
246  const SCH_MARKER* marker = m_MarkersList->GetItem( index );
247 
248  if( marker == NULL )
249  return;
250 
251  // Search for the selected marker
252  unsigned i;
253  SCH_SHEET_LIST sheetList( g_RootSheet );
254  bool notFound = true;
255 
256  for( i = 0; i < sheetList.size(); i++ )
257  {
258  SCH_ITEM* item = (SCH_ITEM*) sheetList[i].LastDrawList();
259 
260  for( ; item; item = item->Next() )
261  {
262  if( item == marker )
263  {
264  notFound = false;
265  break;
266  }
267  }
268 
269  if( notFound == false )
270  break;
271  }
272 
273  if( notFound ) // Error
274  {
275  wxMessageBox( _( "Marker not found" ) );
276 
277  // The marker was deleted, so rebuild marker list
279  return;
280  }
281 
282  if( sheetList[i] != m_parent->GetCurrentSheet() )
283  {
284  m_parent->SetCurrentSheet( sheetList[i] );
286  sheetList[i].LastScreen()->SetZoom( m_parent->GetScreen()->GetZoom() );
288  }
289 
290  m_lastMarkerFound = marker;
291  m_parent->FocusOnLocation( marker->m_Pos, false, true );
292  m_parent->SetCrossHairPosition( marker->m_Pos );
293  RedrawDrawPanel();
294 }
295 
296 
297 void DIALOG_ERC::OnLeftDblClickMarkersList( wxMouseEvent& event )
298 {
299  // Remember: OnLeftClickMarkersList was called just before
300  // and therefore m_lastMarkerFound was initialized.
301  // (NULL if not found)
302  if( m_lastMarkerFound )
303  {
306  RedrawDrawPanel();
307  // prevent a mouse left button release event in
308  // coming from the ERC dialog double click
309  // ( the button is released after closing this dialog and will generate
310  // an unwanted event in parent frame)
312  }
313 
314  Close();
315 }
316 
317 
319 {
320  // Try to know the size of bitmap button used in drc matrix
321  wxBitmapButton * dummy = new wxBitmapButton( m_matrixPanel, wxID_ANY, KiBitmap( ercerr_xpm ) );
322  wxSize bitmap_size = dummy->GetSize();
323  delete dummy;
324 
325  if( !m_diagErcTableInit )
326  {
327  memcpy( DiagErc, DefaultDiagErc, sizeof(DefaultDiagErc) );
328  m_diagErcTableInit = true;
329  }
330 
331  wxPoint pos;
332  // Get the current text size:use a dummy text.
333  wxStaticText* text = new wxStaticText( m_matrixPanel, -1, wxT( "W" ), pos );
334  int text_height = text->GetRect().GetHeight();
335  bitmap_size.y = std::max( bitmap_size.y, text_height );
336  delete text;
337 
338  // compute the Y pos interval:
339  pos.y = text_height;
340 
341  if( m_initialized == false )
342  {
343  std::vector<wxStaticText*> labels;
344 
345  // Print row labels
346  for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
347  {
348  int y = pos.y + (ii * bitmap_size.y);
349  text = new wxStaticText( m_matrixPanel, -1, CommentERC_H[ii],
350  wxPoint( 5, y + ( bitmap_size.y / 2) - (text_height / 2) ) );
351  labels.push_back( text );
352 
353  int x = text->GetRect().GetRight();
354  pos.x = std::max( pos.x, x );
355  }
356 
357  // Right-align
358  for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
359  {
360  wxPoint labelPos = labels[ ii ]->GetPosition();
361  labelPos.x = pos.x - labels[ ii ]->GetRect().GetWidth();
362  labels[ ii ]->SetPosition( labelPos );
363  }
364 
365  pos.x += 5;
366  }
367  else
368  pos = m_buttonList[0][0]->GetPosition();
369 
370  for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
371  {
372  int y = pos.y + (ii * bitmap_size.y);
373 
374  for( int jj = 0; jj <= ii; jj++ )
375  {
376  // Add column labels (only once)
377  int diag = DiagErc[ii][jj];
378  int x = pos.x + (jj * bitmap_size.x);
379 
380  if( (ii == jj) && !m_initialized )
381  {
382  wxPoint txtpos;
383  txtpos.x = x + (bitmap_size.x / 2);
384  txtpos.y = y - text_height;
385  text = new wxStaticText( m_matrixPanel, -1, CommentERC_V[ii], txtpos );
386  }
387 
388  int event_id = ID_MATRIX_0 + ii + ( jj * PINTYPE_COUNT );
389  BITMAP_DEF bitmap_butt = erc_green_xpm;
390 
391  delete m_buttonList[ii][jj];
392  m_buttonList[ii][jj] = new wxBitmapButton( m_matrixPanel,
393  event_id,
394  KiBitmap( bitmap_butt ),
395  wxPoint( x, y ) );
396  setDRCMatrixButtonState( m_buttonList[ii][jj], diag );
397  }
398  }
399 
400  m_initialized = true;
401 }
402 
403 
404 void DIALOG_ERC::setDRCMatrixButtonState( wxBitmapButton *aButton, int aState )
405 {
406  BITMAP_DEF bitmap_butt = NULL;
407  wxString tooltip;
408 
409  switch( aState )
410  {
411  case OK:
412  bitmap_butt = erc_green_xpm;
413  tooltip = _( "No error or warning" );
414  break;
415 
416  case WAR:
417  bitmap_butt = ercwarn_xpm;
418  tooltip = _( "Generate warning" );
419  break;
420 
421  case ERR:
422  bitmap_butt = ercerr_xpm;
423  tooltip = _( "Generate error" );
424  break;
425  }
426 
427  if( bitmap_butt )
428  {
429  aButton->SetBitmap( KiBitmap( bitmap_butt ) );
430  aButton->SetToolTip( tooltip );
431  }
432 }
433 
434 
436 {
437  SCH_SHEET_LIST sheetList( g_RootSheet);
439 
440  for( unsigned i = 0; i < sheetList.size(); i++ )
441  {
442  SCH_ITEM* item = sheetList[i].LastDrawList();
443 
444  for( ; item != NULL; item = item->Next() )
445  {
446  if( item->Type() != SCH_MARKER_T )
447  continue;
448 
449  SCH_MARKER* marker = (SCH_MARKER*) item;
450 
451  if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
452  continue;
453 
454  m_MarkersList->AppendToList( marker );
455  }
456  }
457 
459 }
460 
461 
462 void DIALOG_ERC::ResetDefaultERCDiag( wxCommandEvent& event )
463 {
464  memcpy( DiagErc, DefaultDiagErc, sizeof( DiagErc ) );
468 }
469 
470 
471 void DIALOG_ERC::ChangeErrorLevel( wxCommandEvent& event )
472 {
473  int id, level, ii, x, y;
474  wxPoint pos;
475 
476  id = event.GetId();
477  ii = id - ID_MATRIX_0;
478  wxBitmapButton* butt = (wxBitmapButton*) event.GetEventObject();
479  pos = butt->GetPosition();
480 
481  x = ii / PINTYPE_COUNT; y = ii % PINTYPE_COUNT;
482 
483  level = DiagErc[y][x];
484 
485  //change to the next error level
486  switch( level )
487  {
488  case OK:
489  level = WAR;
490  break;
491 
492  case WAR:
493  level = ERR;
494  break;
495 
496  case ERR:
497  level = OK;
498  break;
499  }
500 
501  setDRCMatrixButtonState( butt, level );
502 
503  DiagErc[y][x] = DiagErc[x][y] = level;
504 }
505 
506 
507 void DIALOG_ERC::TestErc( REPORTER& aReporter )
508 {
509  wxFileName fn;
510 
512 
513  // Build the whole sheet list in hierarchy (sheet, not screen)
514  SCH_SHEET_LIST sheets( g_RootSheet );
515  sheets.AnnotatePowerSymbols();
516 
517  if( m_parent->CheckAnnotate( aReporter, false ) )
518  {
519  if( aReporter.HasMessage() )
520  aReporter.ReportTail( _( "Annotation required!" ), REPORTER::RPT_ERROR );
521 
522  return;
523  }
524 
525  SCH_SCREENS screens;
526 
527  // Erase all previous DRC markers.
529 
530  /* Test duplicate sheet names inside a given sheet, one cannot have sheets with
531  * duplicate names (file names can be duplicated).
532  */
533  TestDuplicateSheetNames( true );
534 
536 
537  // The connection graph has a whole set of ERC checks it can run
540 
541  /* Test is all units of each multiunit component have the same footprint assigned.
542  */
543  TestMultiunitFootprints( sheets );
544 
545  std::unique_ptr<NETLIST_OBJECT_LIST> objectsConnectedList( m_parent->BuildNetListBase() );
546 
547  // Reset the connection type indicator
548  objectsConnectedList->ResetConnectionsType();
549 
550  unsigned lastItemIdx = 0;
551  unsigned nextItemIdx = 0;
552  int MinConn = NOC;
553 
554  /* Check that a pin appears in only one net. This check is necessary
555  * because multi-unit components that have shared pins can be wired to
556  * different nets.
557  */
558  std::unordered_map<wxString, wxString> pin_to_net_map;
559 
560  /* The netlist generated by SCH_EDIT_FRAME::BuildNetListBase is sorted
561  * by net number, which means we can group netlist items into ranges
562  * that live in the same net. The range from nextItem to the current
563  * item (exclusive) needs to be checked against the current item. The
564  * lastItem variable is used as a helper to pass the last item's number
565  * from one loop iteration to the next, which simplifies the initial
566  * pass.
567  */
568 
569  for( unsigned itemIdx = 0; itemIdx < objectsConnectedList->size(); itemIdx++ )
570  {
571  auto item = objectsConnectedList->GetItem( itemIdx );
572  auto lastItem = objectsConnectedList->GetItem( lastItemIdx );
573 
574  auto lastNet = lastItem->GetNet();
575  auto net = item->GetNet();
576 
577  wxASSERT_MSG( lastNet <= net, wxT( "Netlist not correctly ordered" ) );
578 
579  if( lastNet != net )
580  {
581  // New net found:
582  MinConn = NOC;
583  nextItemIdx = itemIdx;
584  }
585 
586  switch( item->m_Type )
587  {
588  // These items do not create erc problems
590  case NET_SEGMENT:
591  case NET_BUS:
592  case NET_JUNCTION:
593  case NET_LABEL:
594  case NET_BUSLABELMEMBER:
595  case NET_PINLABEL:
597  break;
598 
599  // TODO(JE) Port this to the new system
600  case NET_PIN:
601  {
602  // Check if this pin has appeared before on a different net
603  if( item->m_Link )
604  {
605  auto ref = item->GetComponentParent()->GetRef( &item->m_SheetPath );
606  wxString pin_name = ref + "_" + item->m_PinNum;
607 
608  if( pin_to_net_map.count( pin_name ) == 0 )
609  {
610  pin_to_net_map[pin_name] = item->GetNetName();
611  }
612  else if( pin_to_net_map[pin_name] != item->GetNetName() )
613  {
614  SCH_MARKER* marker = new SCH_MARKER();
615 
616  marker->SetTimeStamp( GetNewTimeStamp() );
617  marker->SetData( ERCE_DIFFERENT_UNIT_NET, item->m_Start,
618  wxString::Format( _( "Pin %s on %s is connected to both %s and %s" ),
619  item->m_PinNum, ref, pin_to_net_map[pin_name], item->GetNetName() ),
620  item->m_Start );
623 
624  item->m_SheetPath.LastScreen()->Append( marker );
625  }
626  }
627 
628  // Look for ERC problems between pins:
629  TestOthersItems( objectsConnectedList.get(), itemIdx, nextItemIdx, &MinConn );
630  break;
631  }
632  default:
633  break;
634  }
635 
636  lastItemIdx = itemIdx;
637  }
638 
639  // Test similar labels (i;e. labels which are identical when
640  // using case insensitive comparisons)
642  objectsConnectedList->TestforSimilarLabels();
643 
644  // Displays global results:
645  updateMarkerCounts( &screens );
646 
647  // Display diags:
649 
650  // Display new markers from the current screen:
651  KIGFX::VIEW* view = m_parent->GetCanvas()->GetView();
652 
653  for( auto item = m_parent->GetScreen()->GetDrawItems(); item; item = item->Next() )
654  {
655  if( item->Type() == SCH_MARKER_T )
656  view->Add( item );
657  }
658 
659  m_parent->GetCanvas()->Refresh();
660 
661  // Display message
662  aReporter.ReportTail( _( "Finished" ), REPORTER::RPT_INFO );
663 
665  {
666  fn = g_RootSheet->GetScreen()->GetFileName();
667  fn.SetExt( wxT( "erc" ) );
668 
669  wxFileDialog dlg( this, _( "ERC File" ), fn.GetPath(), fn.GetFullName(),
670  ErcFileWildcard(), wxFD_SAVE );
671 
672  if( dlg.ShowModal() == wxID_CANCEL )
673  return;
674 
675  if( WriteDiagnosticERC( GetUserUnits(), dlg.GetPath() ) )
676  ExecuteFile( this, Pgm().GetEditorName(), QuoteFullPath( fn ) );
677  }
678 }
679 
680 
681 wxDialog* InvokeDialogERC( SCH_EDIT_FRAME* aCaller )
682 {
683  // This is a modeless dialog, so new it rather than instantiating on stack.
684  DIALOG_ERC* dlg = new DIALOG_ERC( aCaller );
685 
686  dlg->Show( true );
687 
688  return dlg; // wxDialog is information hiding about DIALOG_ERC.
689 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Class SCH_SHEET_LIST.
virtual bool HasMessage() const =0
Function HasMessage Returns true if the reporter client is non-empty.
const wxString & GetFileName() const
Definition: sch_screen.h:124
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:404
void DisplayList(EDA_UNITS_T aUnits)
Function DisplayList(); Build the Html marker list and show it.
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:445
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 Init()
Definition: dialog_erc.cpp:113
void transferSettingsToControls()
Definition: dialog_erc.cpp:136
SCH_ITEM * Next() const
Definition: sch_item.h:153
int RunERC(const ERC_SETTINGS &aSettings, bool aCreateMarkers=true)
Runs electrical rule checks on the connectivity graph.
int TestConflictingBusAliases(bool aCreateMarker)
Checks that there are not conflicting bus alias definitions in the schematic.
Definition: erc.cpp:228
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:183
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:69
const wxString CommentERC_H[]
Definition: erc.cpp:87
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
bool write_erc_file
If true, write ERC results to a file.
Definition: erc_settings.h:61
wxCheckBox * m_cbCheckBusEntries
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...
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:258
Class REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:61
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...
CONNECTION_GRAPH * g_ConnectionGraph
This also wants to live in the eventual SCHEMATIC object.
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:268
bool WriteDiagnosticERC(EDA_UNITS_T aUnits, const wxString &aFullFileName)
Function WriteDiagnosticERC save the ERC errors to aFullFileName.
Definition: erc.cpp:598
#define ID_MATRIX_0
Definition: dialog_erc.cpp:65
ERC_HTML_LISTFRAME * m_MarkersList
void SaveProjectSettings(bool aAskForSave) override
Save changes to the project settings to the project (.pro) file.
Class WX_TEXT_CTRL_REPORTER is wrapper for reporting to a wxTextCtrl object.
Definition: reporter.h:144
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:471
void OnLeftClickMarkersList(wxHtmlLinkEvent &event) override
Definition: dialog_erc.cpp:235
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:217
Definition: erc.h:44
bool m_initialized
Definition: dialog_erc.h:45
void OnErcCmpClick(wxCommandEvent &event) override
Definition: dialog_erc.cpp:214
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:44
const wxPoint & GetScrollCenterPosition() const
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:56
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:227
wxPanel * m_matrixPanel
SCH_DRAW_PANEL * GetCanvas() const override
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:297
Definition of file extensions used in Kicad.
void OnButtonCloseClick(wxCommandEvent &event) override
Definition: dialog_erc.cpp:196
void AppendToList(SCH_MARKER *aMarker)
Function AppendToList.
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:182
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:202
KIGFX::SCH_VIEW * GetView() const
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.
void LoadDefaults()
Definition: erc_settings.h:33
ERC_SETTINGS m_settings
Definition: dialog_erc.h:48
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.
const ERC_SETTINGS & GetErcSettings()
eeschema ERC modeless dialog ID
Definition: id.h:281
wxString ErcFileWildcard()
static bool m_diagErcTableInit
Definition: dialog_erc.h:47
#define NOC
Definition: erc.h:82
see class PGM_BASE
const SCH_MARKER * GetItem(unsigned aIndex)
Function GetItem returns a requested DRC_ITEM* or NULL.
virtual void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer) override
Redraw the entire screen area by updating the scroll bars and mouse pointer in order to have aCenterP...
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...
enum TYPEMARKER GetMarkerType() const
Definition: marker_base.h:187
#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:170
void OnResetMatrixClick(wxCommandEvent &event) override
Definition: dialog_erc.cpp:208
size_t i
Definition: json11.cpp:597
void transferControlsToSettings()
Definition: dialog_erc.cpp:148
bool check_bus_entry_conflicts
If true, check that wires connecting to buses actually exist in the bus.
Definition: erc_settings.h:73
void updateMarkerCounts(SCH_SCREENS *screens)
Definition: dialog_erc.cpp:160
wxCheckBox * m_WriteResultOpt
const wxString CommentERC_V[]
Definition: erc.cpp:103
bool check_similar_labels
If true, check each sheet for labels that differ only by letter case.
Definition: erc_settings.h:64
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
Class VIEW.
Definition: view.h:61
void ReBuildMatrixPanel()
Definition: dialog_erc.cpp:318
void TestErc(REPORTER &aReporter)
Definition: dialog_erc.cpp:507
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:462
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:295
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
Definition: sch_item.h:114
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:681
const SCH_MARKER * m_lastMarkerFound
Definition: dialog_erc.h:46
void RecalculateConnections(bool aDoCleanup=true)
Generates the connection data for the entire schematic hierarchy.
wxCheckBox * m_cbCheckBusToNetConflicts
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:493
void DisplayERC_MarkersList()
Definition: dialog_erc.cpp:435
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:209
wxCheckBox * m_cbTestSimilarLabels
EDA_UNITS_T GetUserUnits() const override
Definition: dialog_shim.h:133
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:153