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 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 436 of file dialog_erc.cpp.

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

437 {
438  int id, level, ii, x, y;
439  wxPoint pos;
440 
441  id = event.GetId();
442  ii = id - ID_MATRIX_0;
443  wxBitmapButton* butt = (wxBitmapButton*) event.GetEventObject();
444  pos = butt->GetPosition();
445 
446  x = ii / PINTYPE_COUNT; y = ii % PINTYPE_COUNT;
447 
448  level = DiagErc[y][x];
449 
450  //change to the next error level
451  switch( level )
452  {
453  case OK:
454  level = WAR;
455  break;
456 
457  case WAR:
458  level = ERR;
459  break;
460 
461  case ERR:
462  level = OK;
463  break;
464  }
465 
466  setDRCMatrixButtonState( butt, level );
467 
468  DiagErc[y][x] = DiagErc[x][y] = level;
469 }
Definition: erc.h:43
void setDRCMatrixButtonState(wxBitmapButton *aButton, int aState)
Definition: dialog_erc.cpp:367
#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 398 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().

399 {
400  SCH_SHEET_LIST sheetList( g_RootSheet);
402 
403  for( unsigned i = 0; i < sheetList.size(); i++ )
404  {
405  SCH_ITEM* item = sheetList[i].LastDrawList();
406 
407  for( ; item != NULL; item = item->Next() )
408  {
409  if( item->Type() != SCH_MARKER_T )
410  continue;
411 
412  SCH_MARKER* marker = (SCH_MARKER*) item;
413 
414  if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
415  continue;
416 
417  m_MarkersList->AppendToList( marker );
418  }
419  }
420 
422 }
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:164
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:103
bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 221 of file dialog_shim.cpp.

Referenced by DIALOG_SHIM::IsQuasiModal().

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_PRINT_GENERIC::onCloseButton(), DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), DIALOG_CHOOSE_FOOTPRINT::OnUseBrowser(), DIALOG_CHOOSE_COMPONENT::OnUseBrowser(), DIALOG_SHIM::SetInitialFocus(), 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:153
bool IsQuasiModal()
Definition: dialog_shim.h:95
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:155
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_SHIM::GetUserUnits(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::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(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), and DIALOG_SHIM::GetUserUnits().

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:281
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:523
void DisplayERC_MarkersList()
Definition: dialog_erc.cpp:398
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:142
void ClearList()
Function ClearList deletes all items shown in the list.
void TestErc(REPORTER &aReporter)
Definition: dialog_erc.cpp:472
void DIALOG_ERC::OnLeftClickMarkersList ( wxHtmlLinkEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 201 of file dialog_erc.cpp.

References DisplayERC_MarkersList(), 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(), SCH_BASE_FRAME::RedrawScreen(), EDA_DRAW_FRAME::SetCrossHairPosition(), SCH_EDIT_FRAME::SetCurrentSheet(), and SCH_SHEET_PATH::UpdateAllScreenReferences().

202 {
203  wxString link = event.GetLinkInfo().GetHref();
204 
205  m_lastMarkerFound = NULL;
206 
207  long index;
208 
209  if( !link.ToLong( &index ) )
210  return;
211 
212  const SCH_MARKER* marker = m_MarkersList->GetItem( index );
213 
214  if( marker == NULL )
215  return;
216 
217  // Search for the selected marker
218  unsigned i;
219  SCH_SHEET_LIST sheetList( g_RootSheet );
220  bool notFound = true;
221 
222  for( i = 0; i < sheetList.size(); i++ )
223  {
224  SCH_ITEM* item = (SCH_ITEM*) sheetList[i].LastDrawList();
225 
226  for( ; item; item = item->Next() )
227  {
228  if( item == marker )
229  {
230  notFound = false;
231  break;
232  }
233  }
234 
235  if( notFound == false )
236  break;
237  }
238 
239  if( notFound ) // Error
240  {
241  wxMessageBox( _( "Marker not found" ) );
242 
243  // The marker was deleted, so rebuild marker list
245  return;
246  }
247 
248  if( sheetList[i] != m_parent->GetCurrentSheet() )
249  {
250  sheetList[i].LastScreen()->SetZoom( m_parent->GetScreen()->GetZoom() );
251  m_parent->SetCurrentSheet( sheetList[i] );
253  }
254 
255  m_lastMarkerFound = marker;
256  m_parent->SetCrossHairPosition( marker->m_Pos );
257  m_parent->RedrawScreen( marker->m_Pos, false);
258 }
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...
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
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.
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...
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:398
void DIALOG_ERC::OnLeftDblClickMarkersList ( wxMouseEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 261 of file dialog_erc.cpp.

References m_lastMarkerFound, m_parent, MARKER_BASE::m_Pos, SCH_BASE_FRAME::RedrawScreen(), EDA_DRAW_FRAME::SetCrossHairPosition(), and EDA_DRAW_FRAME::SkipNextLeftButtonReleaseEvent().

262 {
263  // Remember: OnLeftClickMarkersList was called just before
264  // and therefore m_lastMarkerFound was initialized.
265  // (NULL if not found)
266  if( m_lastMarkerFound )
267  {
270  // prevent a mouse left button release event in
271  // coming from the ERC dialog double click
272  // ( the button is released after closing this dialog and will generate
273  // an unwanted event in parent frame)
275  }
276 
277  Close();
278 }
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...
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:42
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 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(), and DIALOG_SHIM::IsQuasiModal().

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:150
bool m_firstPaintEvent
Definition: dialog_shim.h:149
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:425
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(), DIALOG_BOM::getPluginFileName(), 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 281 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, setDRCMatrixButtonState(), wxPoint::x, and wxPoint::y.

Referenced by Init(), and ResetDefaultERCDiag().

282 {
283  // Try to know the size of bitmap button used in drc matrix
284  wxBitmapButton * dummy = new wxBitmapButton( m_matrixPanel, wxID_ANY, KiBitmap( ercerr_xpm ) );
285  wxSize bitmap_size = dummy->GetSize();
286  delete dummy;
287 
288  if( !m_diagErcTableInit )
289  {
290  memcpy( DiagErc, DefaultDiagErc, sizeof(DefaultDiagErc) );
291  m_diagErcTableInit = true;
292  }
293 
294  wxPoint pos;
295  // Get the current text size:use a dummy text.
296  wxStaticText* text = new wxStaticText( m_matrixPanel, -1, wxT( "W" ), pos );
297  int text_height = text->GetRect().GetHeight();
298  bitmap_size.y = std::max( bitmap_size.y, text_height );
299  delete text;
300 
301  // compute the Y pos interval:
302  pos.y = text_height;
303 
304  if( m_initialized == false )
305  {
306  std::vector<wxStaticText*> labels;
307 
308  // Print row labels
309  for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
310  {
311  int y = pos.y + (ii * bitmap_size.y);
312  text = new wxStaticText( m_matrixPanel, -1, CommentERC_H[ii],
313  wxPoint( 5, y + ( bitmap_size.y / 2) - (text_height / 2) ) );
314  labels.push_back( text );
315 
316  int x = text->GetRect().GetRight();
317  pos.x = std::max( pos.x, x );
318  }
319 
320  // Right-align
321  for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
322  {
323  wxPoint labelPos = labels[ ii ]->GetPosition();
324  labelPos.x = pos.x - labels[ ii ]->GetRect().GetWidth();
325  labels[ ii ]->SetPosition( labelPos );
326  }
327 
328  pos.x += 5;
329  }
330  else
331  pos = m_buttonList[0][0]->GetPosition();
332 
333  for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
334  {
335  int y = pos.y + (ii * bitmap_size.y);
336 
337  for( int jj = 0; jj <= ii; jj++ )
338  {
339  // Add column labels (only once)
340  int diag = DiagErc[ii][jj];
341  int x = pos.x + (jj * bitmap_size.x);
342 
343  if( (ii == jj) && !m_initialized )
344  {
345  wxPoint txtpos;
346  txtpos.x = x + (bitmap_size.x / 2);
347  txtpos.y = y - text_height;
348  text = new wxStaticText( m_matrixPanel, -1, CommentERC_V[ii], txtpos );
349  }
350 
351  int event_id = ID_MATRIX_0 + ii + ( jj * PINTYPE_COUNT );
352  BITMAP_DEF bitmap_butt = erc_green_xpm;
353 
354  delete m_buttonList[ii][jj];
355  m_buttonList[ii][jj] = new wxBitmapButton( m_matrixPanel,
356  event_id,
357  KiBitmap( bitmap_butt ),
358  wxPoint( x, y ) );
359  setDRCMatrixButtonState( m_buttonList[ii][jj], diag );
360  }
361  }
362 
363  m_initialized = true;
364 }
void setDRCMatrixButtonState(wxBitmapButton *aButton, int aState)
Definition: dialog_erc.cpp:367
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::ResetDefaultERCDiag ( wxCommandEvent &  event)
private

Definition at line 425 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().

426 {
427  memcpy( DiagErc, DefaultDiagErc, sizeof( DiagErc ) );
429  m_TestSimilarLabels = true;
433 }
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:281
wxCheckBox * m_cbTestSimilarLabels
void DIALOG_ERC::setDRCMatrixButtonState ( wxBitmapButton *  aButton,
int  aState 
)
private

Definition at line 367 of file dialog_erc.cpp.

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

Referenced by ChangeErrorLevel(), and ReBuildMatrixPanel().

368 {
369  BITMAP_DEF bitmap_butt = NULL;
370  wxString tooltip;
371 
372  switch( aState )
373  {
374  case OK:
375  bitmap_butt = erc_green_xpm;
376  tooltip = _( "No error or warning" );
377  break;
378 
379  case WAR:
380  bitmap_butt = ercwarn_xpm;
381  tooltip = _( "Generate warning" );
382  break;
383 
384  case ERR:
385  bitmap_butt = ercerr_xpm;
386  tooltip = _( "Generate error" );
387  break;
388  }
389 
390  if( bitmap_butt )
391  {
392  aButton->SetBitmap( KiBitmap( bitmap_butt ) );
393  aButton->SetToolTip( tooltip );
394  }
395 }
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 86 of file dialog_shim.h.

References DIALOG_SHIM::EndQuasiModal(), DIALOG_SHIM::m_initialFocusTarget, and DIALOG_SHIM::ShowQuasiModal().

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().

87  {
88  m_initialFocusTarget = aWindow;
89  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:150
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(), DIALOG_SHIM::GetUserUnits(), 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, max, wxPoint::x, and wxPoint::y.

Referenced by DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), DIALOG_SHIM::IsQuasiModal(), 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:144
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(), PCB_BASE_FRAME::SelectFootprintFromLibTree(), and DIALOG_SHIM::SetInitialFocus().

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:154
#define WX_EVENT_LOOP
Definition: kiway_player.h:100
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:153
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:155
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 472 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().

473 {
474  wxFileName fn;
475 
476  m_writeErcFile = m_WriteResultOpt->GetValue();
479 
480  // Build the whole sheet list in hierarchy (sheet, not screen)
481  SCH_SHEET_LIST sheets( g_RootSheet );
482  sheets.AnnotatePowerSymbols();
483 
484  if( m_parent->CheckAnnotate( aReporter, false ) )
485  {
486  if( aReporter.HasMessage() )
487  aReporter.ReportTail( _( "Annotation required!" ), REPORTER::RPT_ERROR );
488 
489  return;
490  }
491 
492  SCH_SCREENS screens;
493 
494  // Erase all previous DRC markers.
496 
497  /* Test duplicate sheet names inside a given sheet, one cannot have sheets with
498  * duplicate names (file names can be duplicated).
499  */
500  TestDuplicateSheetNames( true );
501 
502  /* Test is all units of each multiunit component have the same footprint assigned.
503  */
504  TestMultiunitFootprints( sheets );
505 
506  std::unique_ptr<NETLIST_OBJECT_LIST> objectsConnectedList( m_parent->BuildNetListBase() );
507 
508  // Reset the connection type indicator
509  objectsConnectedList->ResetConnectionsType();
510 
511  unsigned lastItemIdx;
512  unsigned nextItemIdx = lastItemIdx = 0;
513  int MinConn = NOC;
514 
515  /* Check that a pin appears in only one net. This check is necessary
516  * because multi-unit components that have shared pins can be wired to
517  * different nets.
518  */
519  std::unordered_map<wxString, wxString> pin_to_net_map;
520 
521  /* The netlist generated by SCH_EDIT_FRAME::BuildNetListBase is sorted
522  * by net number, which means we can group netlist items into ranges
523  * that live in the same net. The range from nextItem to the current
524  * item (exclusive) needs to be checked against the current item. The
525  * lastItem variable is used as a helper to pass the last item's number
526  * from one loop iteration to the next, which simplifies the initial
527  * pass.
528  */
529 
530  for( unsigned itemIdx = 0; itemIdx < objectsConnectedList->size(); itemIdx++ )
531  {
532  auto item = objectsConnectedList->GetItem( itemIdx );
533  auto lastItem = objectsConnectedList->GetItem( lastItemIdx );
534 
535  auto lastNet = lastItem->GetNet();
536  auto net = item->GetNet();
537 
538  wxASSERT_MSG( lastNet <= net, wxT( "Netlist not correctly ordered" ) );
539 
540  if( lastNet != net )
541  {
542  // New net found:
543  MinConn = NOC;
544  nextItemIdx = itemIdx;
545  }
546 
547  switch( item->m_Type )
548  {
549  // These items do not create erc problems
551  case NET_SEGMENT:
552  case NET_BUS:
553  case NET_JUNCTION:
554  case NET_LABEL:
555  case NET_BUSLABELMEMBER:
556  case NET_PINLABEL:
558  break;
559 
560  case NET_HIERLABEL:
562  case NET_SHEETLABEL:
564  // ERC problems when pin sheets do not match hierarchical labels.
565  // Each pin sheet must match a hierarchical label
566  // Each hierarchical label must match a pin sheet
567  objectsConnectedList->TestforNonOrphanLabel( itemIdx, nextItemIdx );
568  break;
569  case NET_GLOBLABEL:
571  objectsConnectedList->TestforNonOrphanLabel( itemIdx, nextItemIdx );
572  break;
573 
574  case NET_NOCONNECT:
575 
576  // ERC problems when a noconnect symbol is connected to more than one pin.
577  MinConn = NET_NC;
578 
579  if( objectsConnectedList->CountPinsInNet( nextItemIdx ) > 1 )
580  Diagnose( item, NULL, MinConn, UNC );
581 
582  break;
583 
584  case NET_PIN:
585  {
586  // Check if this pin has appeared before on a different net
587  if( item->m_Link )
588  {
589  auto ref = item->GetComponentParent()->GetRef( &item->m_SheetPath );
590  wxString pin_name = ref + "_" + item->m_PinNum;
591 
592  if( pin_to_net_map.count( pin_name ) == 0 )
593  {
594  pin_to_net_map[pin_name] = item->GetNetName();
595  }
596  else if( pin_to_net_map[pin_name] != item->GetNetName() )
597  {
598  SCH_MARKER* marker = new SCH_MARKER();
599 
600  marker->SetTimeStamp( GetNewTimeStamp() );
601  marker->SetData( ERCE_DIFFERENT_UNIT_NET, item->m_Start,
602  wxString::Format( _( "Pin %s on %s is connected to both %s and %s" ),
603  item->m_PinNum, ref, pin_to_net_map[pin_name], item->GetNetName() ),
604  item->m_Start );
607 
608  item->m_SheetPath.LastScreen()->Append( marker );
609  }
610  }
611 
612  // Look for ERC problems between pins:
613  TestOthersItems( objectsConnectedList.get(), itemIdx, nextItemIdx, &MinConn );
614  break;
615  }
616  }
617 
618  lastItemIdx = itemIdx;
619  }
620 
621  // Test similar labels (i;e. labels which are identical when
622  // using case insensitive comparisons)
623  if( m_TestSimilarLabels )
624  objectsConnectedList->TestforSimilarLabels();
625 
626  // Displays global results:
627  updateMarkerCounts( &screens );
628 
629  // Display diags:
631 
632  // Display new markers from the current screen:
633  KIGFX::VIEW* view = m_parent->GetCanvas()->GetView();
634 
635  for( auto item = m_parent->GetScreen()->GetDrawItems(); item; item = item->Next() )
636  {
637  if( item->Type() == SCH_MARKER_T )
638  view->Add( item );
639  }
640 
641  m_parent->GetCanvas()->Refresh();
642 
643  // Display message
644  aReporter.ReportTail( _( "Finished" ), REPORTER::RPT_INFO );
645 
646  if( m_writeErcFile )
647  {
648  fn = g_RootSheet->GetScreen()->GetFileName();
649  fn.SetExt( wxT( "erc" ) );
650 
651  wxFileDialog dlg( this, _( "ERC File" ), fn.GetPath(), fn.GetFullName(),
652  ErcFileWildcard(), wxFD_SAVE );
653 
654  if( dlg.ShowModal() == wxID_CANCEL )
655  return;
656 
657  if( WriteDiagnosticERC( GetUserUnits(), dlg.GetPath() ) )
658  ExecuteFile( this, Pgm().GetEditorName(), QuoteFullPath( fn ) );
659  }
660 }
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:109
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:159
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:147
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:335
#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:398
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:206
wxCheckBox * m_cbTestSimilarLabels
EDA_UNITS_T GetUserUnits() const override
Definition: dialog_shim.h:103
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(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), and DIALOG_SHIM::GetUserUnits().

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 149 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

Definition at line 150 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint(), and DIALOG_SHIM::SetInitialFocus().

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 153 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 154 of file dialog_shim.h.

Referenced by DIALOG_SHIM::IsQuasiModal(), and 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: