KiCad PCB EDA Suite
DIALOG_ERC Class Reference

#include <dialog_erc.h>

Inheritance diagram for DIALOG_ERC:
DIALOG_ERC_BASE DIALOG_SHIM KIWAY_HOLDER

Public Member Functions

 DIALOG_ERC (SCH_EDIT_FRAME *parent)
 
 ~DIALOG_ERC ()
 
void SetInitialFocus (wxWindow *aWindow)
 Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown. More...
 
int ShowQuasiModal ()
 
void EndQuasiModal (int retCode)
 
bool IsQuasiModal ()
 
bool Show (bool show) override
 
bool Enable (bool enable) override
 
void OnPaint (wxPaintEvent &event)
 
EDA_UNITS_T GetUserUnits () const override
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Static Public Attributes

static bool m_TestSimilarLabels = true
 

Protected Member Functions

void FinishDialogSettings ()
 In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls. More...
 
void SetSizeInDU (int x, int y)
 Set the dialog to the given dimensions in "dialog units". More...
 
int HorizPixelsFromDU (int x)
 Convert an integer number of dialog units to pixels, horizontally. More...
 
int VertPixelsFromDU (int y)
 Convert an integer number of dialog units to pixels, vertically. More...
 

Protected Attributes

wxNotebook * m_NoteBook
 
wxPanel * m_PanelERC
 
wxStaticText * m_ErcTotalErrorsText
 
wxTextCtrl * m_TotalErrCount
 
wxStaticText * m_WarnErcErrorsText
 
wxTextCtrl * m_LastWarningCount
 
wxStaticText * m_LastErrCountText
 
wxTextCtrl * m_LastErrCount
 
wxStaticLine * m_staticline1
 
wxCheckBox * m_WriteResultOpt
 
wxStaticText * m_titleMessages
 
wxTextCtrl * m_MessagesList
 
wxStaticText * m_textMarkers
 
ERC_HTML_LISTFRAMEm_MarkersList
 
wxButton * m_buttondelmarkers
 
wxStdDialogButtonSizer * m_sdbSizer1
 
wxButton * m_sdbSizer1OK
 
wxButton * m_sdbSizer1Cancel
 
wxPanel * m_PanelERCOptions
 
wxCheckBox * m_cbTestSimilarLabels
 
wxCheckBox * m_cbTestUniqueGlbLabels
 
wxPanel * m_matrixPanel
 
wxButton * m_ResetOptButton
 
EDA_UNITS_T m_units
 
std::string m_hash_key
 
bool m_firstPaintEvent
 
wxWindow * m_initialFocusTarget
 
WX_EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 

Private Member Functions

void Init ()
 
void OnCloseErcDialog (wxCloseEvent &event) override
 
void OnErcCmpClick (wxCommandEvent &event) override
 
void OnEraseDrcMarkersClick (wxCommandEvent &event) override
 
void OnButtonCloseClick (wxCommandEvent &event) override
 
void OnResetMatrixClick (wxCommandEvent &event) override
 
void RedrawDrawPanel ()
 
void OnLeftClickMarkersList (wxHtmlLinkEvent &event) override
 
void OnLeftDblClickMarkersList (wxMouseEvent &event) override
 
void TestErc (REPORTER &aReporter)
 
void DisplayERC_MarkersList ()
 
void ResetDefaultERCDiag (wxCommandEvent &event)
 
void ChangeErrorLevel (wxCommandEvent &event)
 
void ReBuildMatrixPanel ()
 
void setDRCMatrixButtonState (wxBitmapButton *aButton, int aState)
 
void updateMarkerCounts (SCH_SCREENS *screens)
 

Private Attributes

SCH_EDIT_FRAMEm_parent
 
wxBitmapButton * m_buttonList [PINTYPE_COUNT][PINTYPE_COUNT]
 
bool m_initialized
 
const SCH_MARKERm_lastMarkerFound
 

Static Private Attributes

static bool m_writeErcFile = false
 
static bool m_diagErcTableInit = false
 
static bool m_tstUniqueGlobalLabels = true
 

Detailed Description

Definition at line 37 of file dialog_erc.h.

Constructor & Destructor Documentation

DIALOG_ERC::DIALOG_ERC ( SCH_EDIT_FRAME parent)

Referenced by InvokeDialogERC().

DIALOG_ERC::~DIALOG_ERC ( )

Definition at line 103 of file dialog_erc.cpp.

References DIALOG_ERC_BASE::m_cbTestSimilarLabels, DIALOG_ERC_BASE::m_cbTestUniqueGlbLabels, m_TestSimilarLabels, and m_tstUniqueGlobalLabels.

104 {
107 }
static bool m_TestSimilarLabels
Definition: dialog_erc.h:51
wxCheckBox * m_cbTestUniqueGlbLabels
static bool m_tstUniqueGlobalLabels
Definition: dialog_erc.h:48
wxCheckBox * m_cbTestSimilarLabels

Member Function Documentation

void DIALOG_ERC::ChangeErrorLevel ( wxCommandEvent &  event)
private

Definition at line 446 of file dialog_erc.cpp.

References DiagErc, ERR, ID_MATRIX_0, OK, PINTYPE_COUNT, setDRCMatrixButtonState(), and WAR.

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 }
Definition: erc.h:43
void setDRCMatrixButtonState(wxBitmapButton *aButton, int aState)
Definition: dialog_erc.cpp:377
#define ID_MATRIX_0
Definition: dialog_erc.cpp:67
Definition: erc.h:42
Definition: erc.h:44
int DiagErc[PINTYPE_COUNT][PINTYPE_COUNT]
Definition: erc.cpp:124
void DIALOG_ERC::DisplayERC_MarkersList ( )
private

Definition at line 408 of file dialog_erc.cpp.

References ERC_HTML_LISTFRAME::AppendToList(), ERC_HTML_LISTFRAME::ClearList(), ERC_HTML_LISTFRAME::DisplayList(), g_RootSheet, MARKER_BASE::GetMarkerType(), DIALOG_SHIM::GetUserUnits(), i, DIALOG_ERC_BASE::m_MarkersList, MARKER_BASE::MARKER_ERC, SCH_ITEM::Next(), SCH_MARKER_T, and EDA_ITEM::Type().

Referenced by Init(), OnLeftClickMarkersList(), and TestErc().

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 }
Class SCH_SHEET_LIST.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
void DisplayList(EDA_UNITS_T aUnits)
Function DisplayList(); Build the Html marker list and show it.
SCH_ITEM * Next() const
ERC_HTML_LISTFRAME * m_MarkersList
enum TYPEMARKER GetMarkerType() const
Definition: marker_base.h:188
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:56
void AppendToList(SCH_MARKER *aMarker)
Function AppendToList.
void ClearList()
Function ClearList deletes all items shown in the list.
size_t i
Definition: json11.cpp:597
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
EDA_UNITS_T GetUserUnits() const override
Definition: dialog_shim.h:132
bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 221 of file dialog_shim.cpp.

222 {
223  // so we can do logging of this state change:
224 
225 #if defined(DEBUG)
226  const char* type_id = typeid( *this ).name();
227  printf( "wxDialog %s: %s\n", type_id, enable ? "enabled" : "disabled" );
228 #endif
229 
230  return wxDialog::Enable( enable );
231 }
void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 381 of file dialog_shim.cpp.

References DIALOG_SHIM::IsQuasiModal(), DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, and DIALOG_SHIM::Show().

Referenced by DIALOG_SHIM::OnButton(), DIALOG_LIB_EDIT_PIN_TABLE::OnClose(), DIALOG_PRINT_GENERIC::onCloseButton(), DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), DIALOG_CHOOSE_FOOTPRINT::OnUseBrowser(), DIALOG_CHOOSE_COMPONENT::OnUseBrowser(), and DIALOG_SHIM::~DIALOG_SHIM().

382 {
383  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
384  // handle validation in the same way as other dialogs.
385  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
386  return;
387 
388  SetReturnCode( retCode );
389 
390  if( !IsQuasiModal() )
391  {
392  wxFAIL_MSG( wxT( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal wasn't called" ) );
393  return;
394  }
395 
396  if( m_qmodal_loop )
397  {
398  if( m_qmodal_loop->IsRunning() )
399  m_qmodal_loop->Exit( 0 );
400  else
401  m_qmodal_loop->ScheduleExit( 0 );
402 
403  m_qmodal_loop = NULL;
404  }
405 
408 
409  Show( false );
410 }
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:182
bool IsQuasiModal()
Definition: dialog_shim.h:124
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:184
void DIALOG_SHIM::FinishDialogSettings ( )
protectedinherited

In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls.

FinishDialogSettings must be called from derived classes, when all widgets are initialized, and therefore their size fixed. If TransferDataToWindow() is used to initialize widgets, at end of TransferDataToWindow, or better at end of a wxInitDialogEvent handler

In any case, the best way is to call it in a wxInitDialogEvent handler after calling TransfertDataToWindow(), which is the default wxInitDialogEvent handler wxDialog

Definition at line 120 of file dialog_shim.cpp.

References PCAD2KICAD::Center.

Referenced by DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS(), DIALOG_FP_BROWSER_DISPLAY_OPTIONS::DIALOG_FP_BROWSER_DISPLAY_OPTIONS(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG(), DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR(), DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_NETLIST::DIALOG_NETLIST(), DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC(), DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER(), DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES(), DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SELECT_NET_FROM_LIST::DIALOG_SELECT_NET_FROM_LIST(), DIALOG_SET_GRID::DIALOG_SET_GRID(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), PAGED_DIALOG::finishInitialization(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_UPDATE_FIELDS::TransferDataToWindow(), and DIALOG_COLOR_PICKER::TransferDataToWindow().

121 {
122  // must be called from the constructor of derived classes,
123  // when all widgets are initialized, and therefore their size fixed
124 
125  // SetSizeHints fixes the minimal size of sizers in the dialog
126  // (SetSizeHints calls Fit(), so no need to call it)
127  GetSizer()->SetSizeHints( this );
128 
129  // the default position, when calling the first time the dlg
130  Center();
131 }
int DIALOG_SHIM::HorizPixelsFromDU ( int  x)
protectedinherited

Convert an integer number of dialog units to pixels, horizontally.

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 141 of file dialog_shim.cpp.

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), and DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT().

142 {
143  wxSize sz( x, 0 );
144  return ConvertDialogToPixels( sz ).x;
145 }
void DIALOG_ERC::Init ( )
private

Definition at line 110 of file dialog_erc.cpp.

References DisplayERC_MarkersList(), m_buttonList, DIALOG_ERC_BASE::m_cbTestSimilarLabels, DIALOG_ERC_BASE::m_cbTestUniqueGlbLabels, m_initialized, m_TestSimilarLabels, m_tstUniqueGlobalLabels, m_writeErcFile, DIALOG_ERC_BASE::m_WriteResultOpt, PINTYPE_COUNT, ReBuildMatrixPanel(), and updateMarkerCounts().

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 }
static bool m_TestSimilarLabels
Definition: dialog_erc.h:51
static bool m_writeErcFile
Definition: dialog_erc.h:46
bool m_initialized
Definition: dialog_erc.h:44
wxBitmapButton * m_buttonList[PINTYPE_COUNT][PINTYPE_COUNT]
Definition: dialog_erc.h:43
wxCheckBox * m_cbTestUniqueGlbLabels
void updateMarkerCounts(SCH_SCREENS *screens)
Definition: dialog_erc.cpp:134
static bool m_tstUniqueGlobalLabels
Definition: dialog_erc.h:48
wxCheckBox * m_WriteResultOpt
void ReBuildMatrixPanel()
Definition: dialog_erc.cpp:291
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:523
void DisplayERC_MarkersList()
Definition: dialog_erc.cpp:408
wxCheckBox * m_cbTestSimilarLabels
KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in.

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 60 of file kiway_player.h.

References KIWAY_HOLDER::GetUserUnits(), KIWAY_HOLDER::m_kiway, KIWAY_HOLDER::Prj(), KIWAY_HOLDER::SetKiway(), and VTBL_ENTRY.

Referenced by TREEPROJECT_ITEM::Activate(), PCB_BASE_EDIT_FRAME::AddLibrary(), SCH_EDIT_FRAME::AppendSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::KiwayMailIn(), KIWAY_PLAYER::language_change(), KICAD_MANAGER_FRAME::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KICAD_MANAGER_FRAME::LoadProject(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), KICAD_MANAGER_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), KICAD_MANAGER_FRAME::OnEditFpLibTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), KICAD_MANAGER_FRAME::OnEditSymLibTable(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), KICAD_MANAGER_FRAME::OnRunPcbFpEditor(), KICAD_MANAGER_FRAME::OnRunSchLibEditor(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar(), LIB_EDIT_FRAME::refreshSchematic(), KICAD_MANAGER_FRAME::RunEeschema(), KICAD_MANAGER_FRAME::RunPcbNew(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), EDA_BASE_FRAME::ShowPreferences(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::UpdatePart(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

61  {
62  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
63  return *m_kiway;
64  }
KIWAY * m_kiway
Definition: kiway_player.h:94
void DIALOG_ERC::OnButtonCloseClick ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 170 of file dialog_erc.cpp.

171 {
172  Close();
173 }
void DIALOG_ERC::OnCloseErcDialog ( wxCloseEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 176 of file dialog_erc.cpp.

177 {
178  Destroy();
179 }
void DIALOG_ERC::OnEraseDrcMarkersClick ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 157 of file dialog_erc.cpp.

References ERC_HTML_LISTFRAME::ClearList(), SCH_SCREENS::DeleteAllMarkers(), SCH_BASE_FRAME::GetCanvas(), DIALOG_ERC_BASE::m_MarkersList, m_parent, MARKER_BASE::MARKER_ERC, SCH_DRAW_PANEL::Refresh(), and updateMarkerCounts().

158 {
159  SCH_SCREENS ScreenList;
160 
162  updateMarkerCounts( &ScreenList );
163 
165  m_parent->GetCanvas()->Refresh();
166 }
void DeleteAllMarkers(enum MARKER_BASE::TYPEMARKER aMarkerType)
Delete all electronic rules check markers of aMarkerType from all the screens in the list...
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...
ERC_HTML_LISTFRAME * m_MarkersList
SCH_DRAW_PANEL * GetCanvas() const override
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:42
void ClearList()
Function ClearList deletes all items shown in the list.
void updateMarkerCounts(SCH_SCREENS *screens)
Definition: dialog_erc.cpp:134
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:523
void DIALOG_ERC::OnErcCmpClick ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 188 of file dialog_erc.cpp.

References ERC_HTML_LISTFRAME::ClearList(), DIALOG_ERC_BASE::m_MarkersList, DIALOG_ERC_BASE::m_MessagesList, and TestErc().

189 {
190  wxBusyCursor();
192 
193  m_MessagesList->Clear();
194  wxSafeYield(); // m_MarkersList must be redraw
195 
197  TestErc( reporter );
198 }
wxTextCtrl * m_MessagesList
ERC_HTML_LISTFRAME * m_MarkersList
Class WX_TEXT_CTRL_REPORTER is wrapper for reporting to a wxTextCtrl object.
Definition: reporter.h:144
void ClearList()
Function ClearList deletes all items shown in the list.
void TestErc(REPORTER &aReporter)
Definition: dialog_erc.cpp:482
void DIALOG_ERC::OnLeftClickMarkersList ( wxHtmlLinkEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 209 of file dialog_erc.cpp.

References DisplayERC_MarkersList(), EDA_DRAW_FRAME::FocusOnLocation(), g_RootSheet, SCH_EDIT_FRAME::GetCurrentSheet(), ERC_HTML_LISTFRAME::GetItem(), SCH_EDIT_FRAME::GetScreen(), BASE_SCREEN::GetZoom(), i, m_lastMarkerFound, DIALOG_ERC_BASE::m_MarkersList, m_parent, MARKER_BASE::m_Pos, SCH_ITEM::Next(), RedrawDrawPanel(), EDA_DRAW_FRAME::SetCrossHairPosition(), SCH_EDIT_FRAME::SetCurrentSheet(), and SCH_SHEET_PATH::UpdateAllScreenReferences().

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 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Class SCH_SHEET_LIST.
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
Definition: base_screen.h:340
wxPoint m_Pos
position of the marker
Definition: marker_base.h:54
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_ITEM * Next() const
ERC_HTML_LISTFRAME * m_MarkersList
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:56
void RedrawDrawPanel()
Definition: dialog_erc.cpp:201
SCH_SHEET_PATH & GetCurrentSheet()
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:42
const SCH_MARKER * GetItem(unsigned aIndex)
Function GetItem returns a requested DRC_ITEM* or NULL.
size_t i
Definition: json11.cpp:597
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
const SCH_MARKER * m_lastMarkerFound
Definition: dialog_erc.h:45
void DisplayERC_MarkersList()
Definition: dialog_erc.cpp:408
void DIALOG_ERC::OnLeftDblClickMarkersList ( wxMouseEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 270 of file dialog_erc.cpp.

References EDA_DRAW_FRAME::FocusOnLocation(), m_lastMarkerFound, m_parent, MARKER_BASE::m_Pos, RedrawDrawPanel(), EDA_DRAW_FRAME::SetCrossHairPosition(), and EDA_DRAW_FRAME::SkipNextLeftButtonReleaseEvent().

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 }
wxPoint m_Pos
position of the marker
Definition: marker_base.h:54
void SkipNextLeftButtonReleaseEvent()
After calling this function, if the left mouse button is down, the next left mouse button release eve...
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...
void RedrawDrawPanel()
Definition: dialog_erc.cpp:201
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:42
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
const SCH_MARKER * m_lastMarkerFound
Definition: dialog_erc.h:45
void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 283 of file dialog_shim.cpp.

References DIALOG_SHIM::m_firstPaintEvent, and DIALOG_SHIM::m_initialFocusTarget.

Referenced by DIALOG_SHIM::DIALOG_SHIM().

284 {
285  if( m_firstPaintEvent )
286  {
287 #ifdef __WXMAC__
288  fixOSXCancelButtonIssue( this );
289  selectAllInTextCtrls( GetChildren() );
290 #endif
291 
293  m_initialFocusTarget->SetFocus();
294  else
295  SetFocus(); // Focus the dialog itself
296 
297  m_firstPaintEvent = false;
298  }
299 
300  event.Skip();
301 }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:179
bool m_firstPaintEvent
Definition: dialog_shim.h:178
void DIALOG_ERC::OnResetMatrixClick ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 182 of file dialog_erc.cpp.

References ResetDefaultERCDiag().

183 {
184  ResetDefaultERCDiag( event );
185 }
void ResetDefaultERCDiag(wxCommandEvent &event)
Definition: dialog_erc.cpp:435
PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Function Prj returns a reference to the PROJECT "associated with" this KIWAY.

Definition at line 34 of file kiway_holder.cpp.

References KIWAY_HOLDER::Kiway(), and KIWAY::Prj().

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_MANAGER::addLibrary(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), LIB_VIEW_FRAME::BestZoom(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkAliasName(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), KICAD_MANAGER_FRAME::CreateNewProject(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::Files_io_from_id(), NETLIST_DIALOG::GenNetlist(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SCH_BASE_FRAME::GetLibAlias(), SCH_BASE_FRAME::GetLibPart(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), KICAD_MANAGER_FRAME::GetProjectFileName(), LIB_VIEW_FRAME::getSelectedAlias(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), KIWAY_HOLDER::Kiway(), LIB_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), KICAD_MANAGER_FRAME::LoadProject(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged(), DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel(), DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), CVPCB_MAINFRAME::OnConfigurePaths(), FOOTPRINT_EDIT_FRAME::OnConfigurePaths(), KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), KICAD_MANAGER_FRAME::OnRunGerbview(), DIALOG_BOM::OnRunPlugin(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), KICAD_MANAGER_FRAME::OnSaveProject(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::Process_Config(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::saveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), LIB_EDIT_FRAME::savePartAs(), SCH_EDIT_FRAME::SaveProject(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), KICAD_MANAGER_FRAME::SetProjectFileName(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR(), LAUNCHER_PANEL::~LAUNCHER_PANEL(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME().

35 {
36  return Kiway().Prj();
37 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:142
void DIALOG_ERC::ReBuildMatrixPanel ( )
private

Definition at line 291 of file dialog_erc.cpp.

References CommentERC_H, CommentERC_V, DefaultDiagErc, DiagErc, dummy(), ID_MATRIX_0, KiBitmap(), m_buttonList, m_diagErcTableInit, m_initialized, DIALOG_ERC_BASE::m_matrixPanel, max, PINTYPE_COUNT, and setDRCMatrixButtonState().

Referenced by Init(), and ResetDefaultERCDiag().

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 }
void setDRCMatrixButtonState(wxBitmapButton *aButton, int aState)
Definition: dialog_erc.cpp:377
PNG memory record (file in memory).
Definition: bitmap_types.h:43
const wxString CommentERC_H[]
Definition: erc.cpp:87
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
#define ID_MATRIX_0
Definition: dialog_erc.cpp:67
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
bool m_initialized
Definition: dialog_erc.h:44
wxBitmapButton * m_buttonList[PINTYPE_COUNT][PINTYPE_COUNT]
Definition: dialog_erc.h:43
wxPanel * m_matrixPanel
int DiagErc[PINTYPE_COUNT][PINTYPE_COUNT]
Definition: erc.cpp:124
static bool m_diagErcTableInit
Definition: dialog_erc.h:47
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
const wxString CommentERC_V[]
Definition: erc.cpp:103
void DIALOG_ERC::RedrawDrawPanel ( )
private

Definition at line 201 of file dialog_erc.cpp.

References SCH_BASE_FRAME::GetCanvas(), m_parent, and SCH_DRAW_PANEL::Refresh().

Referenced by OnLeftClickMarkersList(), and OnLeftDblClickMarkersList().

202 {
203  WINDOW_THAWER thawer( m_parent );
204 
205  m_parent->GetCanvas()->Refresh();
206 }
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...
SCH_DRAW_PANEL * GetCanvas() const override
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:42
void DIALOG_ERC::ResetDefaultERCDiag ( wxCommandEvent &  event)
private

Definition at line 435 of file dialog_erc.cpp.

References DefaultDiagErc, DiagErc, DIALOG_ERC_BASE::m_cbTestSimilarLabels, DIALOG_ERC_BASE::m_cbTestUniqueGlbLabels, m_TestSimilarLabels, m_tstUniqueGlobalLabels, and ReBuildMatrixPanel().

Referenced by OnResetMatrixClick().

436 {
437  memcpy( DiagErc, DefaultDiagErc, sizeof( DiagErc ) );
439  m_TestSimilarLabels = true;
443 }
static bool m_TestSimilarLabels
Definition: dialog_erc.h:51
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
wxCheckBox * m_cbTestUniqueGlbLabels
int DiagErc[PINTYPE_COUNT][PINTYPE_COUNT]
Definition: erc.cpp:124
static bool m_tstUniqueGlobalLabels
Definition: dialog_erc.h:48
void ReBuildMatrixPanel()
Definition: dialog_erc.cpp:291
wxCheckBox * m_cbTestSimilarLabels
void DIALOG_ERC::setDRCMatrixButtonState ( wxBitmapButton *  aButton,
int  aState 
)
private

Definition at line 377 of file dialog_erc.cpp.

References ERR, KiBitmap(), OK, and WAR.

Referenced by ChangeErrorLevel(), and ReBuildMatrixPanel().

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 }
Definition: erc.h:43
PNG memory record (file in memory).
Definition: bitmap_types.h:43
Definition: erc.h:42
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
Definition: erc.h:44
void DIALOG_SHIM::SetInitialFocus ( wxWindow *  aWindow)
inlineinherited

Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.

Definition at line 115 of file dialog_shim.h.

Referenced by DIALOG_BOM::DIALOG_BOM(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_SET_GRID::DIALOG_SET_GRID(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchAllClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchIDClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchRefClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchSelectedClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchValueClicked(), PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE(), PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), and LIB_EDIT_FRAME::savePartAs().

116  {
117  m_initialFocusTarget = aWindow;
118  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:179
void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

Function SetKiway.

Parameters
aDestis the recipient of aKiway pointer. It is only used for debugging, since "this" is not a wxWindow*. "this" is a KIWAY_HOLDER mix-in.
aKiwayis often from a parent window, or from KIFACE::CreateWindow().

Definition at line 47 of file kiway_holder.cpp.

References KIWAY_HOLDER::m_kiway, and name.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), InvokePcbLibTableEditor(), KIWAY_HOLDER::Kiway(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

48 {
49 #if defined(DEBUG)
50  // offer a trap point for debugging most any window
51  wxASSERT( aDest );
52  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
53  {
54  int breakhere=1;
55  (void) breakhere;
56  }
57 #endif
58 
59  (void) aDest;
60 
61  m_kiway = aKiway;
62 }
KIWAY * m_kiway
Definition: kiway_player.h:94
const char * name
Definition: DXF_plotter.cpp:61
void DIALOG_SHIM::SetSizeInDU ( int  x,
int  y 
)
protectedinherited

Set the dialog to the given dimensions in "dialog units".

These are units equivalent to 4* the average character width and 8* the average character height, allowing a dialog to be sized in a way that scales it with the system font.

Definition at line 134 of file dialog_shim.cpp.

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), HTML_MESSAGE_BOX::HTML_MESSAGE_BOX(), and HTML_MESSAGE_BOX::SetDialogSizeInDU().

135 {
136  wxSize sz( x, y );
137  SetSize( ConvertDialogToPixels( sz ) );
138 }
bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 162 of file dialog_shim.cpp.

References class_map, EDA_RECT::GetPosition(), EDA_RECT::GetSize(), DIALOG_SHIM::m_hash_key, and max.

Referenced by DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), SCH_EDIT_FRAME::OnAnnotate(), DIALOG_SCH_FIND::OnCancel(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DRC::ShowDRCDialog(), DIALOG_SHIM::ShowQuasiModal(), and DIALOG_POSITION_RELATIVE::UpdateAnchor().

163 {
164  bool ret;
165  const char* hash_key;
166 
167  if( m_hash_key.size() )
168  {
169  // a special case like EDA_LIST_DIALOG, which has multiple uses.
170  hash_key = m_hash_key.c_str();
171  }
172  else
173  {
174  hash_key = typeid(*this).name();
175  }
176 
177  // Show or hide the window. If hiding, save current position and size.
178  // If showing, use previous position and size.
179  if( show )
180  {
181 #ifndef __WINDOWS__
182  wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
183 #endif
184  ret = wxDialog::Show( show );
185 
186  // classname is key, returns a zeroed out default EDA_RECT if none existed before.
187  EDA_RECT savedDialogRect = class_map[ hash_key ];
188 
189  if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
190  {
191  SetSize( savedDialogRect.GetPosition().x,
192  savedDialogRect.GetPosition().y,
193  std::max( wxDialog::GetSize().x, savedDialogRect.GetSize().x ),
194  std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
195  0 );
196  }
197 
198  // Be sure that the dialog appears in a visible area
199  // (the dialog position might have been stored at the time when it was
200  // shown on another display)
201  if( wxDisplay::GetFromWindow( this ) == wxNOT_FOUND )
202  Centre();
203  }
204  else
205  {
206  // Save the dialog's position & size before hiding, using classname as key
207  class_map[ hash_key ] = EDA_RECT( wxDialog::GetPosition(), wxDialog::GetSize() );
208 
209 #ifdef __WXMAC__
210  if ( m_eventLoop )
211  m_eventLoop->Exit( GetReturnCode() ); // Needed for APP-MODAL dlgs on OSX
212 #endif
213 
214  ret = wxDialog::Show( show );
215  }
216 
217  return ret;
218 }
const wxSize GetSize() const
Definition: eda_rect.h:101
std::string m_hash_key
Definition: dialog_shim.h:173
static RECT_MAP class_map
const wxPoint GetPosition() const
Definition: eda_rect.h:113
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 327 of file dialog_shim.cpp.

References DBG, DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, DIALOG_SHIM::Show(), and WX_EVENT_LOOP.

Referenced by SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditField(), EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), SCH_EDIT_FRAME::InstallHierarchyFrame(), PCB_BASE_FRAME::InstallPadOptionsFrame(), InvokeDialogEditComponentsLibId(), InvokeDialogUpdateFields(), LIB_EDIT_FRAME::OnEditComponentProperties(), PCB_EDIT_FRAME::OnEditTracksAndVias(), SCH_EDIT_FRAME::OnLaunchBomManager(), SCH_EDIT_FRAME::OnRemapSymbols(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), EDIT_TOOL::Properties(), SCH_BASE_FRAME::SelectComponentFromLibTree(), and PCB_BASE_FRAME::SelectFootprintFromLibTree().

328 {
329  // This is an exception safe way to zero a pointer before returning.
330  // Yes, even though DismissModal() clears this first normally, this is
331  // here in case there's an exception before the dialog is dismissed.
332  struct NULLER
333  {
334  void*& m_what;
335  NULLER( void*& aPtr ) : m_what( aPtr ) {}
336  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
337  } clear_this( (void*&) m_qmodal_loop );
338 
339  // release the mouse if it's currently captured as the window having it
340  // will be disabled when this dialog is shown -- but will still keep the
341  // capture making it impossible to do anything in the modal dialog itself
342  wxWindow* win = wxWindow::GetCapture();
343  if( win )
344  win->ReleaseMouse();
345 
346  // Get the optimal parent
347  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
348 
349  // Show the optimal parent
350  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
351 
352  wxASSERT_MSG( !m_qmodal_parent_disabler,
353  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
354 
355  // quasi-modal: disable only my "optimal" parent
357 
358 #ifdef __WXMAC__
359  // Apple in its infinite wisdom will raise a disabled window before even passing
360  // us the event, so we have no way to stop it. Instead, we must set an order on
361  // the windows so that the quasi-modal will be pushed in front of the disabled
362  // window when it is raised.
363  ReparentQuasiModal();
364 #endif
365  Show( true );
366 
367  m_qmodal_showing = true;
368 
369  WX_EVENT_LOOP event_loop;
370 
371  m_qmodal_loop = &event_loop;
372 
373  event_loop.Run();
374 
375  m_qmodal_showing = false;
376 
377  return GetReturnCode();
378 }
bool m_qmodal_showing
Definition: dialog_shim.h:183
#define WX_EVENT_LOOP
Definition: kiway_player.h:100
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:182
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:184
Toggle a window&#39;s "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:33
#define DBG(x)
Definition: fctsys.h:33
void DIALOG_ERC::TestErc ( REPORTER aReporter)
private

Definition at line 482 of file dialog_erc.cpp.

References KIGFX::VIEW::Add(), SCH_SHEET_LIST::AnnotatePowerSymbols(), SCH_EDIT_FRAME::BuildNetListBase(), SCH_EDIT_FRAME::CheckAnnotate(), SCH_SCREENS::DeleteAllMarkers(), Diagnose(), DisplayERC_MarkersList(), ERCE_DIFFERENT_UNIT_NET, ErcFileWildcard(), ExecuteFile(), Format(), g_RootSheet, SCH_BASE_FRAME::GetCanvas(), SCH_SCREEN::GetDrawItems(), SCH_SCREEN::GetFileName(), GetNewTimeStamp(), SCH_EDIT_FRAME::GetScreen(), SCH_SHEET::GetScreen(), DIALOG_SHIM::GetUserUnits(), SCH_DRAW_PANEL::GetView(), REPORTER::HasMessage(), DIALOG_ERC_BASE::m_cbTestSimilarLabels, DIALOG_ERC_BASE::m_cbTestUniqueGlbLabels, m_parent, m_TestSimilarLabels, m_tstUniqueGlobalLabels, m_writeErcFile, DIALOG_ERC_BASE::m_WriteResultOpt, MARKER_BASE::MARKER_ERC, MARKER_BASE::MARKER_SEVERITY_ERROR, NET_BUS, NET_BUSLABELMEMBER, NET_GLOBBUSLABELMEMBER, NET_GLOBLABEL, NET_HIERBUSLABELMEMBER, NET_HIERLABEL, NET_ITEM_UNSPECIFIED, NET_JUNCTION, NET_LABEL, NET_NC, NET_NOCONNECT, NET_PIN, NET_PINLABEL, NET_SEGMENT, NET_SHEETBUSLABELMEMBER, NET_SHEETLABEL, SCH_ITEM::Next(), NOC, Pgm(), QuoteFullPath(), SCH_DRAW_PANEL::Refresh(), REPORTER::ReportTail(), REPORTER::RPT_ERROR, REPORTER::RPT_INFO, SCH_MARKER_T, MARKER_BASE::SetData(), MARKER_BASE::SetErrorLevel(), MARKER_BASE::SetMarkerType(), EDA_ITEM::SetTimeStamp(), TestDuplicateSheetNames(), TestMultiunitFootprints(), TestOthersItems(), UNC, updateMarkerCounts(), and WriteDiagnosticERC().

Referenced by OnErcCmpClick().

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 }
Class SCH_SHEET_LIST.
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
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 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
const wxString & GetFileName() const
Definition: sch_screen.h:131
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.
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
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...
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 ERCE_DIFFERENT_UNIT_NET
Definition: erc.h:65
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
timestamp_t GetNewTimeStamp()
Definition: common.cpp:212
int TestDuplicateSheetNames(bool aCreateMarker)
Function TestDuplicateSheetNames( ) inside a given sheet, one cannot have sheets with duplicate names...
Definition: erc.cpp:177
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:111
SCH_DRAW_PANEL * GetCanvas() const override
Definition: erc.h:45
void SetMarkerType(enum TYPEMARKER aMarkerType)
accessors to set/get marker type (DRC, ERC, or other)
Definition: marker_base.h:183
KIGFX::SCH_VIEW * GetView() const
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:42
wxCheckBox * m_cbTestUniqueGlbLabels
int CheckAnnotate(REPORTER &aReporter, bool aOneSheetOnly)
Check for annotation errors.
Definition: annotate.cpp:245
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:160
wxString ErcFileWildcard()
#define NOC
Definition: erc.h:73
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
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:171
void updateMarkerCounts(SCH_SCREENS *screens)
Definition: dialog_erc.cpp:134
static bool m_tstUniqueGlobalLabels
Definition: dialog_erc.h:48
wxCheckBox * m_WriteResultOpt
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:345
#define NET_NC
Definition: erc.h:71
Class VIEW.
Definition: view.h:61
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
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
void DIALOG_ERC::updateMarkerCounts ( SCH_SCREENS screens)
private

Definition at line 134 of file dialog_erc.cpp.

References SCH_SCREENS::GetMarkerCount(), DIALOG_ERC_BASE::m_LastErrCount, DIALOG_ERC_BASE::m_LastWarningCount, DIALOG_ERC_BASE::m_TotalErrCount, MARKER_BASE::MARKER_ERC, MARKER_BASE::MARKER_SEVERITY_ERROR, MARKER_BASE::MARKER_SEVERITY_UNSPEC, and MARKER_BASE::MARKER_SEVERITY_WARNING.

Referenced by Init(), OnEraseDrcMarkersClick(), and TestErc().

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 }
wxTextCtrl * m_TotalErrCount
wxTextCtrl * m_LastWarningCount
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.
wxTextCtrl * m_LastErrCount
int DIALOG_SHIM::VertPixelsFromDU ( int  y)
protectedinherited

Convert an integer number of dialog units to pixels, vertically.

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 148 of file dialog_shim.cpp.

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), and DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT().

149 {
150  wxSize sz( 0, y );
151  return ConvertDialogToPixels( sz ).y;
152 }

Member Data Documentation

wxButton* DIALOG_ERC_BASE::m_buttondelmarkers
protectedinherited
wxBitmapButton* DIALOG_ERC::m_buttonList[PINTYPE_COUNT][PINTYPE_COUNT]
private

Definition at line 43 of file dialog_erc.h.

Referenced by Init(), and ReBuildMatrixPanel().

wxCheckBox* DIALOG_ERC_BASE::m_cbTestSimilarLabels
protectedinherited
wxCheckBox* DIALOG_ERC_BASE::m_cbTestUniqueGlbLabels
protectedinherited
bool DIALOG_ERC::m_diagErcTableInit = false
staticprivate

Definition at line 47 of file dialog_erc.h.

Referenced by ReBuildMatrixPanel().

wxStaticText* DIALOG_ERC_BASE::m_ErcTotalErrorsText
protectedinherited

Definition at line 52 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE().

bool DIALOG_SHIM::m_firstPaintEvent
protectedinherited

Definition at line 178 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

Definition at line 179 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

bool DIALOG_ERC::m_initialized
private

Definition at line 44 of file dialog_erc.h.

Referenced by Init(), and ReBuildMatrixPanel().

wxTextCtrl* DIALOG_ERC_BASE::m_LastErrCount
protectedinherited

Definition at line 57 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE(), and updateMarkerCounts().

wxStaticText* DIALOG_ERC_BASE::m_LastErrCountText
protectedinherited

Definition at line 56 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE().

const SCH_MARKER* DIALOG_ERC::m_lastMarkerFound
private

Definition at line 45 of file dialog_erc.h.

Referenced by OnLeftClickMarkersList(), and OnLeftDblClickMarkersList().

wxTextCtrl* DIALOG_ERC_BASE::m_LastWarningCount
protectedinherited

Definition at line 55 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE(), and updateMarkerCounts().

wxPanel* DIALOG_ERC_BASE::m_matrixPanel
protectedinherited

Definition at line 71 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE(), and ReBuildMatrixPanel().

wxTextCtrl* DIALOG_ERC_BASE::m_MessagesList
protectedinherited

Definition at line 61 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE(), and OnErcCmpClick().

wxNotebook* DIALOG_ERC_BASE::m_NoteBook
protectedinherited

Definition at line 50 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE().

wxPanel* DIALOG_ERC_BASE::m_PanelERC
protectedinherited

Definition at line 51 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE().

wxPanel* DIALOG_ERC_BASE::m_PanelERCOptions
protectedinherited

Definition at line 68 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE().

SCH_EDIT_FRAME* DIALOG_ERC::m_parent
private
WX_EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 182 of file dialog_shim.h.

Referenced by DIALOG_SHIM::EndQuasiModal(), and DIALOG_SHIM::ShowQuasiModal().

WDO_ENABLE_DISABLE* DIALOG_SHIM::m_qmodal_parent_disabler
protectedinherited
bool DIALOG_SHIM::m_qmodal_showing
protectedinherited

Definition at line 183 of file dialog_shim.h.

Referenced by DIALOG_SHIM::ShowQuasiModal().

wxButton* DIALOG_ERC_BASE::m_ResetOptButton
protectedinherited
wxStdDialogButtonSizer* DIALOG_ERC_BASE::m_sdbSizer1
protectedinherited

Definition at line 65 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE().

wxButton* DIALOG_ERC_BASE::m_sdbSizer1Cancel
protectedinherited
wxButton* DIALOG_ERC_BASE::m_sdbSizer1OK
protectedinherited
wxStaticLine* DIALOG_ERC_BASE::m_staticline1
protectedinherited

Definition at line 58 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE().

bool DIALOG_ERC::m_TestSimilarLabels = true
static
wxStaticText* DIALOG_ERC_BASE::m_textMarkers
protectedinherited

Definition at line 62 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE().

wxStaticText* DIALOG_ERC_BASE::m_titleMessages
protectedinherited

Definition at line 60 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE().

wxTextCtrl* DIALOG_ERC_BASE::m_TotalErrCount
protectedinherited

Definition at line 53 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE(), and updateMarkerCounts().

bool DIALOG_ERC::m_tstUniqueGlobalLabels = true
staticprivate

Definition at line 48 of file dialog_erc.h.

Referenced by Init(), ResetDefaultERCDiag(), TestErc(), and ~DIALOG_ERC().

wxStaticText* DIALOG_ERC_BASE::m_WarnErcErrorsText
protectedinherited

Definition at line 54 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE().

bool DIALOG_ERC::m_writeErcFile = false
staticprivate

Definition at line 46 of file dialog_erc.h.

Referenced by Init(), and TestErc().

wxCheckBox* DIALOG_ERC_BASE::m_WriteResultOpt
protectedinherited

Definition at line 59 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE(), Init(), and TestErc().


The documentation for this class was generated from the following files: