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 Types

enum  HOLDER_TYPE { DIALOG, FRAME, PANEL, SCREEN }
 

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 GetUserUnits () const
 
HOLDER_TYPE GetType ()
 
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 Member Functions

static bool IsCtrl (int aChar, const wxKeyEvent &e)
 
static bool IsShiftCtrl (int aChar, const wxKeyEvent &e)
 

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...
 
void ResetSize ()
 Clear the existing dialog size and position. More...
 

Protected Attributes

wxStaticText * m_titleMessages
 
wxTextCtrl * m_MessagesList
 
wxStaticText * m_textMarkers
 
wxDataViewCtrl * m_markerDataView
 
wxStaticText * m_showLabel
 
wxCheckBox * m_showAll
 
wxCheckBox * m_showErrors
 
wxStaticBitmap * m_errorsBadge
 
wxCheckBox * m_showWarnings
 
wxStaticBitmap * m_warningsBadge
 
wxCheckBox * m_showExclusions
 
wxStaticBitmap * m_exclusionsBadge
 
wxButton * m_saveReport
 
wxStaticLine * m_staticline1
 
wxBoxSizer * m_buttonsSizer
 
wxButton * m_buttondelmarkers
 
wxStdDialogButtonSizer * m_sdbSizer1
 
wxButton * m_sdbSizer1OK
 
wxButton * m_sdbSizer1Cancel
 
EDA_UNITS 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
 
std::vector< wxWindow * > m_tabOrder
 

Private Member Functions

void OnCloseErcDialog (wxCloseEvent &event) override
 
void OnRunERCClick (wxCommandEvent &event) override
 
void OnEraseDrcMarkersClick (wxCommandEvent &event) override
 
void OnERCItemSelected (wxDataViewEvent &aEvent) override
 
void OnERCItemDClick (wxDataViewEvent &aEvent) override
 
void OnERCItemRClick (wxDataViewEvent &aEvent) override
 
void OnSeverity (wxCommandEvent &aEvent) override
 
void OnSaveReport (wxCommandEvent &aEvent) override
 
void OnButtonCloseClick (wxCommandEvent &event) override
 
void RedrawDrawPanel ()
 
void TestErc (REPORTER &aReporter)
 
bool writeReport (const wxString &aFullFileName)
 
void deleteAllMarkers ()
 
void syncCheckboxes ()
 
void updateDisplayedCounts ()
 

Private Attributes

SCH_EDIT_FRAMEm_parent
 
RC_ITEMS_PROVIDERm_markerProvider
 
RC_TREE_MODELm_markerTreeModel
 
int m_severities
 

Detailed Description

Definition at line 37 of file dialog_erc.h.

Member Enumeration Documentation

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 
SCREEN 

Definition at line 42 of file kiway_holder.h.

Constructor & Destructor Documentation

◆ DIALOG_ERC()

DIALOG_ERC::DIALOG_ERC ( SCH_EDIT_FRAME parent)

Definition at line 52 of file dialog_erc.cpp.

52  :
53  DIALOG_ERC_BASE( parent, ID_DIALOG_ERC ), // parent looks for this ID explicitly
54  m_parent( parent ),
56 {
57  EESCHEMA_SETTINGS* settings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
59 
62  m_markerDataView->AssociateModel( m_markerTreeModel );
63 
64  wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
65  infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
66  m_textMarkers->SetFont( infoFont );
67  m_titleMessages->SetFont( infoFont );
68 
73 
74  // We use a sdbSizer to get platform-dependent ordering of the action buttons, but
75  // that requires us to correct the button labels here.
76  m_sdbSizer1OK->SetLabel( _( "Run" ) );
77  m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
78  m_sdbSizer1->Layout();
79 
80  m_sdbSizer1OK->SetDefault();
81 
82  // Now all widgets have the size fixed, call FinishDialogSettings
84 }
void SetProvider(RC_ITEMS_PROVIDER *aProvider)
Definition: rc_item.cpp:166
RC_TREE_MODEL * m_markerTreeModel
Definition: dialog_erc.h:43
void syncCheckboxes()
Definition: dialog_erc.cpp:146
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
RC_ITEMS_PROVIDER * m_markerProvider
Definition: dialog_erc.h:42
void updateDisplayedCounts()
Definition: dialog_erc.cpp:96
SHEETLIST_ERC_ITEMS_PROVIDER is an implementation of the RC_ITEM_LISTinterface which uses the global ...
Definition: erc_item.h:54
wxButton * m_sdbSizer1Cancel
void SetSeverities(int aSeverities)
Definition: rc_item.cpp:172
wxButton * m_sdbSizer1OK
wxStdDialogButtonSizer * m_sdbSizer1
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
wxStaticText * m_textMarkers
int m_severities
Definition: dialog_erc.h:45
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:40
DIALOG_ERC_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Electrical Rules Checker"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
eeschema ERC modeless dialog ID
Definition: id.h:220
wxDataViewCtrl * m_markerDataView
wxStaticText * m_titleMessages
#define _(s)
Definition: 3d_actions.cpp:33

References _, EESCHEMA_SETTINGS::APPEARANCE::erc_severities, DIALOG_SHIM::FinishDialogSettings(), Kiface(), EESCHEMA_SETTINGS::m_Appearance, DIALOG_ERC_BASE::m_markerDataView, m_markerProvider, m_markerTreeModel, DIALOG_ERC_BASE::m_sdbSizer1, DIALOG_ERC_BASE::m_sdbSizer1Cancel, DIALOG_ERC_BASE::m_sdbSizer1OK, m_severities, DIALOG_ERC_BASE::m_textMarkers, DIALOG_ERC_BASE::m_titleMessages, RC_TREE_MODEL::SetProvider(), RC_TREE_MODEL::SetSeverities(), syncCheckboxes(), and updateDisplayedCounts().

◆ ~DIALOG_ERC()

DIALOG_ERC::~DIALOG_ERC ( )

Definition at line 87 of file dialog_erc.cpp.

88 {
89  EESCHEMA_SETTINGS* settings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
91 
92  m_markerTreeModel->DecRef();
93 }
RC_TREE_MODEL * m_markerTreeModel
Definition: dialog_erc.h:43
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
int m_severities
Definition: dialog_erc.h:45

References EESCHEMA_SETTINGS::APPEARANCE::erc_severities, Kiface(), EESCHEMA_SETTINGS::m_Appearance, m_markerTreeModel, and m_severities.

Member Function Documentation

◆ deleteAllMarkers()

void DIALOG_ERC::deleteAllMarkers ( )
private

Definition at line 523 of file dialog_erc.cpp.

524 {
525  // Clear current selection list to avoid selection of deleted items
527 
529 }
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
RC_TREE_MODEL * m_markerTreeModel
Definition: dialog_erc.h:43
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:139
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:58
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:40
void DeleteAllItems()
Definition: rc_item.cpp:341

References EE_ACTIONS::clearSelection, RC_TREE_MODEL::DeleteAllItems(), EDA_BASE_FRAME::GetToolManager(), m_markerTreeModel, m_parent, and TOOL_MANAGER::RunAction().

Referenced by OnEraseDrcMarkersClick(), and OnRunERCClick().

◆ Enable()

bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 262 of file dialog_shim.cpp.

263 {
264  // so we can do logging of this state change:
265 
266 #if 0 && defined(DEBUG)
267  const char* type_id = typeid( *this ).name();
268  printf( "DIALOG_SHIM %s: %s\n", type_id, enable ? "enabled" : "disabled" );
269  fflush(0); //Needed on msys2 to immediately print the message
270 #endif
271 
272  return wxDialog::Enable( enable );
273 }

◆ EndQuasiModal()

void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 419 of file dialog_shim.cpp.

420 {
421  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
422  // handle validation in the same way as other dialogs.
423  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
424  return;
425 
426  SetReturnCode( retCode );
427 
428  if( !IsQuasiModal() )
429  {
430  wxFAIL_MSG( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal"
431  "wasn't called" );
432  return;
433  }
434 
435  if( m_qmodal_loop )
436  {
437  if( m_qmodal_loop->IsRunning() )
438  m_qmodal_loop->Exit( 0 );
439  else
440  m_qmodal_loop->ScheduleExit( 0 );
441 
443  }
444 
447 
448  Show( false );
449 }
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:205
#define NULL
bool IsQuasiModal()
Definition: dialog_shim.h:124
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:208

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

Referenced by HK_PROMPT_DIALOG::EndFlexible(), DIALOG_SHIM::OnButton(), DIALOG_EDIT_COMPONENTS_LIBID::onCancel(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCancelButtonClick(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnCancelButtonClick(), DIALOG_LIB_EDIT_PIN_TABLE::OnClose(), DIALOG_PRINT_GENERIC::onCloseButton(), DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), HTML_MESSAGE_BOX::OnOKButtonClick(), DIALOG_CHOOSE_FOOTPRINT::OnUseBrowser(), DIALOG_CHOOSE_COMPONENT::OnUseBrowser(), and DIALOG_SHIM::~DIALOG_SHIM().

◆ FinishDialogSettings()

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 137 of file dialog_shim.cpp.

138 {
139  // must be called from the constructor of derived classes,
140  // when all widgets are initialized, and therefore their size fixed
141 
142  // SetSizeHints fixes the minimal size of sizers in the dialog
143  // (SetSizeHints calls Fit(), so no need to call it)
144  GetSizer()->SetSizeHints( this );
145 
146  // the default position, when calling the first time the dlg
147  Center();
148 }

References PCAD2KICAD::Center.

Referenced by DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DRC::DIALOG_DRC(), 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_EDIT_SHEET_PIN::DIALOG_EDIT_SHEET_PIN(), DIALOG_EDITOR_DATA::DIALOG_EDITOR_DATA(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_ERC(), 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_GENCAD_EXPORT_OPTIONS::DIALOG_GENCAD_EXPORT_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_LIB_TABLE_CONFIG::DIALOG_GLOBAL_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_PRIMITIVE_POLY_PROPS::DIALOG_PAD_PRIMITIVE_POLY_PROPS(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PASTE_SPECIAL::DIALOG_PASTE_SPECIAL(), 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_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), 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_FROM_PCB::DIALOG_UPDATE_FROM_PCB(), 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_SCH_SHEET_PROPS::OnInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_UPDATE_FIELDS::TransferDataToWindow(), DIALOG_COLOR_PICKER::TransferDataToWindow(), and DIALOG_BOARD_STATISTICS::TransferDataToWindow().

◆ GetType()

HOLDER_TYPE KIWAY_HOLDER::GetType ( )
inlineinherited

Definition at line 49 of file kiway_holder.h.

49 { return m_type; }
HOLDER_TYPE m_type
Definition: kiway_holder.h:82

References KIWAY_HOLDER::m_type.

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ GetUserUnits()

◆ HorizPixelsFromDU()

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 158 of file dialog_shim.cpp.

159 {
160  wxSize sz( x, 0 );
161  return ConvertDialogToPixels( sz ).x;
162 }

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

◆ IsCtrl()

static bool DIALOG_SHIM::IsCtrl ( int  aChar,
const wxKeyEvent &  e 
)
inlinestaticinherited

Definition at line 137 of file dialog_shim.h.

138  {
139  return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
140  !e.ShiftDown() && !e.MetaDown();
141  }

Referenced by DIALOG_TEXT_PROPERTIES::OnCharHook(), and DIALOG_LABEL_EDITOR::OnCharHook().

◆ IsQuasiModal()

◆ IsShiftCtrl()

static bool DIALOG_SHIM::IsShiftCtrl ( int  aChar,
const wxKeyEvent &  e 
)
inlinestaticinherited

Definition at line 143 of file dialog_shim.h.

144  {
145  return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
146  e.ShiftDown() && !e.MetaDown();
147  }

Referenced by DIALOG_TEXT_PROPERTIES::OnCharHook(), and DIALOG_LABEL_EDITOR::OnCharHook().

◆ Kiway()

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 56 of file kiway_holder.h.

57  {
58  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
59  return *m_kiway;
60  }
KIWAY * m_kiway
Definition: kiway_holder.h:81

References KIWAY_HOLDER::m_kiway.

Referenced by TREEPROJECT_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_CONTROL::AddSymbolToSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), COMMON_CONTROL::ConfigurePaths(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), SCH_EDIT_FRAME::CreateScreens(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), CVPCB_MAINFRAME::DisplayStatus(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), EDIT_TOOL::EditFpInFpEditor(), SCH_EDITOR_CONTROL::EditWithLibEdit(), BACK_ANNOTATE::FetchNetlistFromPCB(), 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::InitSheet(), KICAD_MANAGER_FRAME::language_change(), KIWAY_PLAYER::language_change(), LIB_TREE_MODEL_ADAPTER::LIB_TREE_MODEL_ADAPTER(), CVPCB_MAINFRAME::LoadFootprintFiles(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadSheetFromFile(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), KICAD_MANAGER_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnExit(), FOOTPRINT_EDIT_FRAME::OnExitKiCad(), FOOTPRINT_VIEWER_FRAME::OnExitKiCad(), LIB_EDIT_FRAME::OnExitKiCad(), SAVE_AS_TRAVERSER::OnFile(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenPcbnew(), EDA_BASE_FRAME::OnPreferences(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), SCH_EDIT_FRAME::OnUpdatePCB(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDITOR_CONTROL::Paste(), KIWAY_HOLDER::Prj(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::rescueProject(), EE_INSPECTION_TOOL::RunSimulation(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), LIB_TREE_MODEL_ADAPTER::SavePinnedItems(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeClearHighlight(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlistToCvpcb(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), CVPCB_CONTROL::ShowFootprintViewer(), COMMON_CONTROL::ShowLibraryTable(), COMMON_CONTROL::ShowPlayer(), KICAD_MANAGER_CONTROL::ShowPlayer(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow(), LIB_MANAGER::UpdatePart(), PCB_EDITOR_CONTROL::UpdateSchematicFromPCB(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

◆ OnButtonCloseClick()

void DIALOG_ERC::OnButtonCloseClick ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 127 of file dialog_erc.cpp.

128 {
129  m_parent->FocusOnItem( nullptr );
130 
131  Close();
132 }
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:40
void FocusOnItem(SCH_ITEM *aItem)

References SCH_BASE_FRAME::FocusOnItem(), and m_parent.

◆ OnCloseErcDialog()

void DIALOG_ERC::OnCloseErcDialog ( wxCloseEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 135 of file dialog_erc.cpp.

136 {
137  m_parent->FocusOnItem( nullptr );
138 
139  Destroy();
140 }
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:40
void FocusOnItem(SCH_ITEM *aItem)

References SCH_BASE_FRAME::FocusOnItem(), and m_parent.

◆ OnEraseDrcMarkersClick()

void DIALOG_ERC::OnEraseDrcMarkersClick ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 117 of file dialog_erc.cpp.

118 {
120 
122  m_parent->GetCanvas()->Refresh();
123 }
void updateDisplayedCounts()
Definition: dialog_erc.cpp:96
void deleteAllMarkers()
Definition: dialog_erc.cpp:523
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:40
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...

References deleteAllMarkers(), SCH_BASE_FRAME::GetCanvas(), m_parent, EDA_DRAW_PANEL_GAL::Refresh(), and updateDisplayedCounts().

◆ OnERCItemDClick()

void DIALOG_ERC::OnERCItemDClick ( wxDataViewEvent &  aEvent)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 365 of file dialog_erc.cpp.

366 {
367  if( aEvent.GetItem().IsOk() )
368  {
369  // turn control over to m_parent, hide this DIALOG_ERC window,
370  // no destruction so we can preserve listbox cursor
371  if( !IsModal() )
372  Show( false );
373  }
374 
375  aEvent.Skip();
376 }
bool Show(bool show) override

References DIALOG_SHIM::Show().

◆ OnERCItemRClick()

void DIALOG_ERC::OnERCItemRClick ( wxDataViewEvent &  aEvent)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 379 of file dialog_erc.cpp.

380 {
381  RC_TREE_NODE* node = RC_TREE_MODEL::ToNode( aEvent.GetItem() );
382 
383  if( !node )
384  return;
385 
386  RC_ITEM* rcItem = node->m_RcItem;
387  wxString listName;
388  wxMenu menu;
389 
390  switch( GetSeverity( rcItem->GetErrorCode() ) )
391  {
392  case RPT_SEVERITY_ERROR: listName = _( "errors" ); break;
393  case RPT_SEVERITY_WARNING: listName = _( "warnings" ); break;
394  default: listName = _( "appropriate" ); break;
395  }
396 
397  if( rcItem->GetParent()->IsExcluded() )
398  {
399  menu.Append( 1, _( "Remove exclusion for this violation" ),
400  wxString::Format( _( "It will be placed back in the %s list" ), listName ) );
401  }
402  else
403  {
404  menu.Append( 2, _( "Exclude this violation" ),
405  wxString::Format( _( "It will be excluded from the %s list" ), listName ) );
406  }
407 
408  menu.AppendSeparator();
409 
410  if( GetSeverity( rcItem->GetErrorCode() ) == RPT_SEVERITY_WARNING )
411  {
412  menu.Append( 3, wxString::Format( _( "Change severity to Error for all '%s' violations" ),
413  rcItem->GetErrorText(),
414  _( "Violation severities can also be edited in the Board Setup... dialog" ) ) );
415  }
416  else
417  {
418  menu.Append( 4, wxString::Format( _( "Change severity to Warning for all '%s' violations" ),
419  rcItem->GetErrorText(),
420  _( "Violation severities can also be edited in the Board Setup... dialog" ) ) );
421  }
422 
423  menu.Append( 5, wxString::Format( _( "Ignore all '%s' violations" ),
424  rcItem->GetErrorText() ),
425  _( "Violations will not be checked or reported" ) );
426 
427  menu.AppendSeparator();
428 
429  menu.Append( 6, _( "Edit violation severities..." ), _( "Open the Schematic Setup... dialog" ) );
430 
431  switch( GetPopupMenuSelectionFromUser( menu ) )
432  {
433  case 1:
434  node->m_RcItem->GetParent()->SetExcluded( false );
435 
436  // Update view
437  static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
439  break;
440 
441  case 2:
442  node->m_RcItem->GetParent()->SetExcluded( true );
443 
444  // Update view
446  static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
447  else
448  static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->DeleteCurrentItem( false );
449 
451  break;
452 
453  case 3:
455 
456  // Rebuild model and view
457  static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markerProvider );
459  break;
460 
461  case 4:
463 
464  // Rebuild model and view
465  static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markerProvider );
467  break;
468 
469  case 5:
470  {
472 
473  SCH_SCREENS ScreenList;
474  ScreenList.DeleteMarkers( MARKER_BASE::MARKER_ERC, rcItem->GetErrorCode() );
475 
476  // Rebuild model and view
477  static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markerProvider );
479  }
480  break;
481 
482  case 6:
483  m_parent->DoShowSchematicSetupDialog( _( "Violation Severity" ) );
484  break;
485  }
486 }
int GetSeverity(int aErrorCode)
RC_ITEM is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item.
Definition: rc_item.h:82
RC_ITEMS_PROVIDER * m_markerProvider
Definition: dialog_erc.h:42
void updateDisplayedCounts()
Definition: dialog_erc.cpp:96
void SetExcluded(bool aExcluded)
Definition: marker_base.h:173
static RC_TREE_NODE * ToNode(wxDataViewItem aItem)
Definition: rc_item.h:322
int GetErrorCode() const
Definition: rc_item.h:273
int m_severities
Definition: dialog_erc.h:45
void DoShowSchematicSetupDialog(const wxString &aInitialPage=wxEmptyString, const wxString &aInitialParentPage=wxEmptyString)
bool IsExcluded() const
Definition: marker_base.h:172
virtual wxString GetErrorText() const =0
Function GetErrorText returns the string form of a drc error code.
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:40
RC_ITEM * m_RcItem
Definition: rc_item.h:307
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
#define _(s)
Definition: 3d_actions.cpp:33
void SetSeverity(int aErrorCode, int aSeverity)
MARKER_BASE * GetParent() const
Definition: rc_item.h:256
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:491
void DeleteMarkers(enum MARKER_BASE::TYPEMARKER aMarkerTyp, int aErrorCode)
Delete all markers of a particular type and error code.

References _, SCH_SCREENS::DeleteMarkers(), SCH_EDIT_FRAME::DoShowSchematicSetupDialog(), Format(), RC_ITEM::GetErrorCode(), RC_ITEM::GetErrorText(), RC_ITEM::GetParent(), GetSeverity(), MARKER_BASE::IsExcluded(), m_markerProvider, m_parent, RC_TREE_NODE::m_RcItem, m_severities, MARKER_BASE::MARKER_ERC, RPT_SEVERITY_ERROR, RPT_SEVERITY_EXCLUSION, RPT_SEVERITY_IGNORE, RPT_SEVERITY_WARNING, MARKER_BASE::SetExcluded(), SetSeverity(), RC_TREE_MODEL::ToNode(), and updateDisplayedCounts().

◆ OnERCItemSelected()

void DIALOG_ERC::OnERCItemSelected ( wxDataViewEvent &  aEvent)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 335 of file dialog_erc.cpp.

336 {
337  const KIID& itemID = RC_TREE_MODEL::ToUUID( aEvent.GetItem() );
338  SCH_SHEET_LIST sheetList( g_RootSheet );
339  SCH_SHEET_PATH sheet;
340  SCH_ITEM* item = sheetList.GetItem( itemID, &sheet );
341 
342  if( item )
343  {
344  WINDOW_THAWER thawer( m_parent );
345 
346  if( sheet != m_parent->GetCurrentSheet() )
347  {
350 
351  m_parent->SetCurrentSheet( sheet );
353  sheet.LastScreen()->SetZoom( m_parent->GetScreen()->GetZoom() );
355  }
356 
357  m_parent->FocusOnItem( item );
358  RedrawDrawPanel();
359  }
360 
361  aEvent.Skip();
362 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
SCH_SHEET_LIST.
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
virtual void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
double GetZoom() const
Function GetZoom returns the current "zoom factor", which is a measure of "internal units per device ...
Definition: base_screen.h:240
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:139
static KIID ToUUID(wxDataViewItem aItem)
Definition: rc_item.cpp:67
void DisplayCurrentSheet()
Draw the current sheet on the display.
Definition: hierarch.cpp:218
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
Definition: common.h:65
void RedrawDrawPanel()
Definition: dialog_erc.cpp:168
SCH_SHEET_PATH & GetCurrentSheet()
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:58
virtual bool SetZoom(double iu_per_du)
Function SetZoom adjusts the current zoom factor.
Definition: base_screen.cpp:88
SCH_SHEET_PATH.
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:40
void FocusOnItem(SCH_ITEM *aItem)
SCH_SCREEN * LastScreen()
Function LastScreen.
VECTOR2D m_ScrollCenter
Current scroll center point in logical units.
Definition: base_screen.h:127
SCH_SHEET * g_RootSheet
SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147

References ACTIONS::cancelInteractive, EE_ACTIONS::clearSelection, SCH_EDIT_FRAME::DisplayCurrentSheet(), SCH_BASE_FRAME::FocusOnItem(), g_RootSheet, SCH_EDIT_FRAME::GetCurrentSheet(), SCH_EDIT_FRAME::GetScreen(), EDA_BASE_FRAME::GetToolManager(), BASE_SCREEN::GetZoom(), SCH_SHEET_PATH::LastScreen(), m_parent, BASE_SCREEN::m_ScrollCenter, RedrawDrawPanel(), SCH_BASE_FRAME::RedrawScreen(), TOOL_MANAGER::RunAction(), SCH_EDIT_FRAME::SetCurrentSheet(), BASE_SCREEN::SetZoom(), and RC_TREE_MODEL::ToUUID().

◆ OnPaint()

void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 320 of file dialog_shim.cpp.

321 {
322  if( m_firstPaintEvent )
323  {
324 #ifdef __WXMAC__
325  fixOSXCancelButtonIssue( this );
326 #endif
327 
328  selectAllInTextCtrls( GetChildren() );
329 
331  m_initialFocusTarget->SetFocus();
332  else
333  SetFocus(); // Focus the dialog itself
334 
335  m_firstPaintEvent = false;
336  }
337 
338  event.Skip();
339 }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:203
bool m_firstPaintEvent
Definition: dialog_shim.h:202
static void selectAllInTextCtrls(wxWindowList &children)

References DIALOG_SHIM::m_firstPaintEvent, DIALOG_SHIM::m_initialFocusTarget, and selectAllInTextCtrls().

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ OnRunERCClick()

void DIALOG_ERC::OnRunERCClick ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 155 of file dialog_erc.cpp.

156 {
157  wxBusyCursor busy;
159 
160  m_MessagesList->Clear();
161  wxSafeYield(); // m_MarkersList must be redraw
162 
164  TestErc( reporter );
165 }
wxTextCtrl * m_MessagesList
WX_TEXT_CTRL_REPORTER is wrapper for reporting to a wxTextCtrl object.
Definition: reporter.h:129
void deleteAllMarkers()
Definition: dialog_erc.cpp:523
void TestErc(REPORTER &aReporter)
Definition: dialog_erc.cpp:176

References deleteAllMarkers(), DIALOG_ERC_BASE::m_MessagesList, and TestErc().

◆ OnSaveReport()

void DIALOG_ERC::OnSaveReport ( wxCommandEvent &  aEvent)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 532 of file dialog_erc.cpp.

533 {
534  wxFileName fn( "./ERC." + ReportFileExtension );
535 
536  wxFileDialog dlg( this, _( "Save Report to File" ), fn.GetPath(), fn.GetFullName(),
537  ReportFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
538 
539  if( dlg.ShowModal() != wxID_OK )
540  return;
541 
542  fn = dlg.GetPath();
543 
544  if( fn.GetExt().IsEmpty() )
545  fn.SetExt( ReportFileExtension );
546 
547  if( !fn.IsAbsolute() )
548  {
549  wxString prj_path = Prj().GetProjectPath();
550  fn.MakeAbsolute( prj_path );
551  }
552 
553  if( writeReport( fn.GetFullPath() ) )
554  {
555  m_MessagesList->AppendText( wxString::Format( _( "Report file '%s' created\n" ),
556  fn.GetFullPath() ) );
557  }
558  else
559  {
560  DisplayError( this, wxString::Format( _( "Unable to create report file '%s'" ),
561  fn.GetFullPath() ) );
562  }
563 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
wxTextCtrl * m_MessagesList
bool writeReport(const wxString &aFullFileName)
Definition: dialog_erc.cpp:566
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:102
wxString ReportFileWildcard()
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
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
const std::string ReportFileExtension
#define _(s)
Definition: 3d_actions.cpp:33

References _, DisplayError(), Format(), PROJECT::GetProjectPath(), DIALOG_ERC_BASE::m_MessagesList, KIWAY_HOLDER::Prj(), ReportFileExtension, ReportFileWildcard(), and writeReport().

◆ OnSeverity()

void DIALOG_ERC::OnSeverity ( wxCommandEvent &  aEvent)
overrideprivatevirtual

Reimplemented from DIALOG_ERC_BASE.

Definition at line 489 of file dialog_erc.cpp.

490 {
491  int flag = 0;
492 
493  if( aEvent.GetEventObject() == m_showAll )
494  flag = RPT_SEVERITY_ALL;
495  else if( aEvent.GetEventObject() == m_showErrors )
496  flag = RPT_SEVERITY_ERROR;
497  else if( aEvent.GetEventObject() == m_showWarnings )
498  flag = RPT_SEVERITY_WARNING;
499  else if( aEvent.GetEventObject() == m_showExclusions )
500  flag = RPT_SEVERITY_EXCLUSION;
501 
502  if( aEvent.IsChecked() )
503  m_severities |= flag;
504  else if( aEvent.GetEventObject() == m_showAll )
506  else
507  m_severities &= ~flag;
508 
509  syncCheckboxes();
510 
511  // Set the provider's severity levels through the TreeModel so that the old tree
512  // can be torn down before the severity changes.
513  //
514  // It's not clear this is required, but we've had a lot of issues with wxDataView
515  // being cranky on various platforms.
516 
518 
520 }
RC_TREE_MODEL * m_markerTreeModel
Definition: dialog_erc.h:43
void syncCheckboxes()
Definition: dialog_erc.cpp:146
wxCheckBox * m_showExclusions
void updateDisplayedCounts()
Definition: dialog_erc.cpp:96
static int RPT_SEVERITY_ALL
Definition: dialog_erc.cpp:143
void SetSeverities(int aSeverities)
Definition: rc_item.cpp:172
wxCheckBox * m_showAll
int m_severities
Definition: dialog_erc.h:45
wxCheckBox * m_showWarnings
wxCheckBox * m_showErrors

References m_markerTreeModel, m_severities, DIALOG_ERC_BASE::m_showAll, DIALOG_ERC_BASE::m_showErrors, DIALOG_ERC_BASE::m_showExclusions, DIALOG_ERC_BASE::m_showWarnings, RPT_SEVERITY_ALL, RPT_SEVERITY_ERROR, RPT_SEVERITY_EXCLUSION, RPT_SEVERITY_WARNING, RC_TREE_MODEL::SetSeverities(), syncCheckboxes(), and updateDisplayedCounts().

◆ Prj()

PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

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

Definition at line 35 of file kiway_holder.cpp.

36 {
37  return Kiway().Prj();
38 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:171

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

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_MANAGER::addLibrary(), LIB_CONTROL::AddSymbolToSchematic(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), KICAD_MANAGER_FRAME::CreateNewProject(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS(), 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(), CVPCB_MAINFRAME::DisplayStatus(), PCB_EDIT_FRAME::doAutoSave(), KICAD_MANAGER_CONTROL::Execute(), PCB_EDIT_FRAME::Export_IDF3(), LIB_CONTROL::ExportSymbolAsSVG(), LIB_CONTROL::ExportView(), PCB_EDIT_FRAME::ExportVRML_File(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SCH_BASE_FRAME::GetLibPart(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), KICAD_MANAGER_FRAME::GetProjectFileName(), LIB_VIEW_FRAME::GetSelectedSymbol(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDITOR_CONTROL::ImportFPAssignments(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), LIB_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProjectFile(), CVPCB_MAINFRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), SCH_EDIT_FRAME::LoadSheetFromFile(), DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged(), DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), SCH_EDIT_FRAME::OnCloseWindow(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnOpenCvpcb(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_BOM::OnRunGenerator(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), OnSaveReport(), DIALOG_DRC::OnSaveReport(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), SCH_EDIT_FRAME::OnUpdatePCB(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), SCH_EDITOR_CONTROL::Paste(), MODULE_EDITOR_TOOLS::PasteFootprint(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), SCH_DRAWING_TOOLS::PlaceComponent(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::Print(), SCH_EDIT_FRAME::PrintPage(), 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(), SCH_EDIT_FRAME::RescueLegacyProject(), SCH_EDIT_FRAME::RescueSymbolLibTableProject(), 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(), DIALOG_BOARD_STATISTICS::saveReportClicked(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectCompFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), LIB_EDIT_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(), EE_INSPECTION_TOOL::ShowDatasheet(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), LIB_VIEW_FRAME::ShowModal(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), NETLIST_DIALOG::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_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(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME().

◆ RedrawDrawPanel()

void DIALOG_ERC::RedrawDrawPanel ( )
private

Definition at line 168 of file dialog_erc.cpp.

169 {
170  WINDOW_THAWER thawer( m_parent );
171 
172  m_parent->GetCanvas()->Refresh();
173 }
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:40
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...

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

Referenced by OnERCItemSelected().

◆ ResetSize()

void DIALOG_SHIM::ResetSize ( )
protectedinherited

Clear the existing dialog size and position.

This will cause the dialog size to be clear so the next time the dialog is shown the sizers will layout the dialog accordingly. This useful when there are dialog windows that size changes due to layout dependency hidden controls.

Definition at line 237 of file dialog_shim.cpp.

238 {
239  const char* hash_key;
240 
241  if( m_hash_key.size() )
242  {
243  // a special case like EDA_LIST_DIALOG, which has multiple uses.
244  hash_key = m_hash_key.c_str();
245  }
246  else
247  {
248  hash_key = typeid(*this).name();
249  }
250 
251  RECT_MAP::iterator it = class_map.find( hash_key );
252 
253  if( it == class_map.end() )
254  return;
255 
256  EDA_RECT rect = it->second;
257  rect.SetSize( 0, 0 );
258  class_map[ hash_key ] = rect;
259 }
std::string m_hash_key
Definition: dialog_shim.h:197
static RECT_MAP class_map
void SetSize(const wxSize &size)
Definition: eda_rect.h:144
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

References class_map, DIALOG_SHIM::m_hash_key, and EDA_RECT::SetSize().

Referenced by DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY().

◆ SetInitialFocus()

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.

116  {
117  m_initialFocusTarget = aWindow;
118  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:203

References DIALOG_SHIM::m_initialFocusTarget.

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_EDIT_SHEET_PIN::DIALOG_EDIT_SHEET_PIN(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FIND::DIALOG_FIND(), 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_IMPORT_GFX::DIALOG_IMPORT_GFX(), 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_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_SCH_FIND::DIALOG_SCH_FIND(), 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(), LIB_EDIT_FRAME::savePartAs(), DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow(), DIALOG_KEEPOUT_AREA_PROPERTIES::TransferDataToWindow(), and DIALOG_COPPER_ZONE::TransferDataToWindow().

◆ SetKiway()

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 42 of file kiway_holder.cpp.

43 {
44 #if defined(DEBUG)
45  // offer a trap point for debugging most any window
46  wxASSERT( aDest );
47  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
48  {
49  int breakhere=1;
50  (void) breakhere;
51  }
52 #endif
53 
54  (void) aDest;
55 
56  m_kiway = aKiway;
57 }
KIWAY * m_kiway
Definition: kiway_holder.h:81
const char * name
Definition: DXF_plotter.cpp:60

References KIWAY_HOLDER::m_kiway, and name.

Referenced by BM2CMP_FRAME::BM2CMP_FRAME(), InvokePcbLibTableEditor(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

◆ SetSizeInDU()

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 151 of file dialog_shim.cpp.

152 {
153  wxSize sz( x, y );
154  SetSize( ConvertDialogToPixels( sz ) );
155 }

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

◆ Show()

bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 178 of file dialog_shim.cpp.

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

References class_map, EDA_RECT::GetPosition(), EDA_RECT::GetSize(), DIALOG_SHIM::m_hash_key, wxPoint::x, and wxPoint::y.

Referenced by DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), SCH_EDIT_FRAME::OnAnnotate(), DIALOG_DRC::OnDRCItemDClick(), OnERCItemDClick(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnLeftDClickItem(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DRC::ShowDRCDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), DIALOG_SHIM::ShowQuasiModal(), DIALOG_POSITION_RELATIVE::UpdateAnchor(), and SCH_EDIT_FRAME::UpdateHierarchyNavigator().

◆ ShowQuasiModal()

int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 365 of file dialog_shim.cpp.

366 {
367  // This is an exception safe way to zero a pointer before returning.
368  // Yes, even though DismissModal() clears this first normally, this is
369  // here in case there's an exception before the dialog is dismissed.
370  struct NULLER
371  {
372  void*& m_what;
373  NULLER( void*& aPtr ) : m_what( aPtr ) {}
374  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
375  } clear_this( (void*&) m_qmodal_loop );
376 
377  // release the mouse if it's currently captured as the window having it
378  // will be disabled when this dialog is shown -- but will still keep the
379  // capture making it impossible to do anything in the modal dialog itself
380  wxWindow* win = wxWindow::GetCapture();
381  if( win )
382  win->ReleaseMouse();
383 
384  // Get the optimal parent
385  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
386 
387  // Show the optimal parent
388  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
389 
390  wxASSERT_MSG( !m_qmodal_parent_disabler,
391  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
392 
393  // quasi-modal: disable only my "optimal" parent
395 
396 #ifdef __WXMAC__
397  // Apple in its infinite wisdom will raise a disabled window before even passing
398  // us the event, so we have no way to stop it. Instead, we must set an order on
399  // the windows so that the quasi-modal will be pushed in front of the disabled
400  // window when it is raised.
401  ReparentQuasiModal();
402 #endif
403  Show( true );
404 
405  m_qmodal_showing = true;
406 
407  WX_EVENT_LOOP event_loop;
408 
409  m_qmodal_loop = &event_loop;
410 
411  event_loop.Run();
412 
413  m_qmodal_showing = false;
414 
415  return GetReturnCode();
416 }
bool m_qmodal_showing
Definition: dialog_shim.h:207
#define WX_EVENT_LOOP
Definition: kiway_player.h:41
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:205
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:208
Toggle a window's "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:35
#define DBG(x)
Definition: fctsys.h:33

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 PCB_EDIT_FRAME::DoShowBoardSetupDialog(), SCH_EDIT_FRAME::DoShowSchematicSetupDialog(), LIB_EDIT_TOOL::editFieldProperties(), SCH_EDITOR_CONTROL::EditSymbolFields(), LIB_EDIT_TOOL::editSymbolProperties(), GLOBAL_EDIT_TOOL::EditTracksAndVias(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), PCB_BASE_FRAME::InstallPadOptionsFrame(), InvokeDialogEditComponentsLibId(), InvokeDialogRescueEach(), InvokeDialogUpdateFields(), SCH_EDIT_FRAME::OnRemapSymbols(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), SCH_BASE_FRAME::SelectCompFromLibTree(), and PCB_BASE_FRAME::SelectFootprintFromLibTree().

◆ syncCheckboxes()

◆ TestErc()

void DIALOG_ERC::TestErc ( REPORTER aReporter)
private

Definition at line 176 of file dialog_erc.cpp.

177 {
178  wxFileName fn;
179 
180  // Build the whole sheet list in hierarchy (sheet, not screen)
181  SCH_SHEET_LIST sheets( g_RootSheet );
182  sheets.AnnotatePowerSymbols();
183 
184  if( m_parent->CheckAnnotate( aReporter, false ) )
185  {
186  if( aReporter.HasMessage() )
187  aReporter.ReportTail( _( "Annotation required!" ), RPT_SEVERITY_ERROR );
188 
189  return;
190  }
191 
192  SCH_SCREENS screens;
193 
194  // Test duplicate sheet names inside a given sheet. While one can have multiple references
195  // to the same file, each must have a unique name.
197  {
198  aReporter.ReportTail( _( "Checking sheet names...\n" ), RPT_SEVERITY_INFO );
199  TestDuplicateSheetNames( true );
200  }
201 
203  {
204  aReporter.ReportTail( _( "Checking bus conflicts...\n" ), RPT_SEVERITY_INFO );
206  }
207 
208  // The connection graph has a whole set of ERC checks it can run
209  aReporter.ReportTail( _( "Checking conflicts...\n" ) );
212 
213  // Test is all units of each multiunit component have the same footprint assigned.
215  {
216  aReporter.ReportTail( _( "Checking footprints...\n" ), RPT_SEVERITY_INFO );
217  TestMultiunitFootprints( sheets );
218  }
219 
220  std::unique_ptr<NETLIST_OBJECT_LIST> objectsConnectedList( m_parent->BuildNetListBase() );
221 
222  // Reset the connection type indicator
223  objectsConnectedList->ResetConnectionsType();
224 
225  unsigned lastItemIdx = 0;
226  unsigned nextItemIdx = 0;
227  int MinConn = NOC;
228 
229  // Check that a pin appears in only one net. This check is necessary because multi-unit
230  // components that have shared pins could be wired to different nets.
231  std::unordered_map<wxString, wxString> pin_to_net_map;
232 
233  // The netlist generated by SCH_EDIT_FRAME::BuildNetListBase is sorted by net number, which
234  // means we can group netlist items into ranges that live in the same net. The range from
235  // nextItem to the current item (exclusive) needs to be checked against the current item.
236  // The lastItem variable is used as a helper to pass the last item's number from one loop
237  // iteration to the next, which simplifies the initial pass.
238  aReporter.ReportTail( _( "Checking connections...\n" ), RPT_SEVERITY_INFO );
239  for( unsigned itemIdx = 0; itemIdx < objectsConnectedList->size(); itemIdx++ )
240  {
241  auto item = objectsConnectedList->GetItem( itemIdx );
242  auto lastItem = objectsConnectedList->GetItem( lastItemIdx );
243 
244  auto lastNet = lastItem->GetNet();
245  auto net = item->GetNet();
246 
247  wxASSERT_MSG( lastNet <= net, wxT( "Netlist not correctly ordered" ) );
248 
249  if( lastNet != net )
250  {
251  // New net found:
252  MinConn = NOC;
253  nextItemIdx = itemIdx;
254  }
255 
256  switch( item->m_Type )
257  {
258  // These items do not create erc problems
261  case NETLIST_ITEM::BUS:
263  case NETLIST_ITEM::LABEL:
267  break;
268 
269  // TODO(JE) Port this to the new system
270  case NETLIST_ITEM::PIN:
271  {
272  // Check if this pin has appeared before on a different net
273  if( item->m_Link && g_ErcSettings->IsTestEnabled( ERCE_DIFFERENT_UNIT_NET ) )
274  {
275  wxString ref = item->GetComponentParent()->GetRef( &item->m_SheetPath );
276  wxString pin_name = ref + "_" + item->m_PinNum;
277  wxString msg;
278 
279  if( pin_to_net_map.count( pin_name ) == 0 )
280  {
281  pin_to_net_map[pin_name] = item->GetNetName();
282  }
283  else if( pin_to_net_map[pin_name] != item->GetNetName() )
284  {
285  msg.Printf( _( "Pin %s on %s is connected to both %s and %s" ),
286  item->m_PinNum,
287  ref,
288  pin_to_net_map[pin_name],
289  item->GetNetName() );
290 
292  marker->SetData( ERCE_DIFFERENT_UNIT_NET, item->m_Start, msg, item->m_Start );
293  item->m_SheetPath.LastScreen()->Append( marker );
294  }
295  }
296 
297  // Look for ERC problems between pins:
298  TestOthersItems( objectsConnectedList.get(), itemIdx, nextItemIdx, &MinConn );
299  break;
300  }
301  default:
302  break;
303  }
304 
305  lastItemIdx = itemIdx;
306  }
307 
308  // Test similar labels (i;e. labels which are identical when
309  // using case insensitive comparisons)
311  {
312  aReporter.ReportTail( _( "Checking labels...\n" ), RPT_SEVERITY_INFO );
313  objectsConnectedList->TestforSimilarLabels();
314  }
315 
316  // Display diags:
318 
319  // Displays global results:
321 
322  // Display new markers from the current screen:
323  KIGFX::VIEW* view = m_parent->GetCanvas()->GetView();
324 
325  for( auto item : m_parent->GetScreen()->Items().OfType( SCH_MARKER_T ) )
326  view->Add( item );
327 
328  m_parent->GetCanvas()->Refresh();
329 
330  // Display message
331  aReporter.ReportTail( _( "Finished" ), RPT_SEVERITY_INFO );
332 }
SCH_SHEET_LIST.
KIGFX::SCH_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
virtual bool HasMessage() const =0
Function HasMessage Returns true if the reporter client is non-empty.
NETLIST_OBJECT_LIST * BuildNetListBase(bool updateStatusText=true)
Create a flat list which stores all connected objects.
void SetProvider(RC_ITEMS_PROVIDER *aProvider)
Definition: rc_item.cpp:166
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generates the connection data for the entire schematic hierarchy.
RC_TREE_MODEL * m_markerTreeModel
Definition: dialog_erc.h:43
bool IsTestEnabled(int aErrorCode) const
Definition: erc_settings.h:68
EE_TYPE OfType(KICAD_T aType)
Definition: sch_rtree.h:219
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Function ReportTail Places the report at the end of the list, for objects that support report orderin...
Definition: reporter.h:92
RC_ITEMS_PROVIDER * m_markerProvider
Definition: dialog_erc.h:42
void updateDisplayedCounts()
Definition: dialog_erc.cpp:96
CONNECTION_GRAPH * g_ConnectionGraph
This also wants to live in the eventual SCHEMATIC object.
int TestConflictingBusAliases()
Checks that there are not conflicting bus alias definitions in the schematic.
ERC_SETTINGS * g_ErcSettings
This also wants to live in the eventual SCHEMATIC object.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
int TestDuplicateSheetNames(bool aCreateMarker)
Function TestDuplicateSheetNames( ) inside a given sheet, one cannot have sheets with duplicate names...
SCH_EDIT_FRAME * m_parent
Definition: dialog_erc.h:40
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
int CheckAnnotate(REPORTER &aReporter, bool aOneSheetOnly)
Check for annotation errors.
#define NOC
Definition: erc.h:83
#define _(s)
Definition: 3d_actions.cpp:33
EE_RTREE & Items()
Definition: sch_screen.h:127
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...
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
SCH_SHEET * g_RootSheet
void SetData(EDA_UNITS aUnits, int aErrorCode, const wxPoint &aMarkerPos, EDA_ITEM *aItem, const wxPoint &aPos, EDA_ITEM *bItem=nullptr, const wxPoint &bPos=wxPoint())
Function SetData fills in all the reportable data associated with a MARKER.
Definition: marker_base.cpp:91
VIEW.
Definition: view.h:61
int TestMultiunitFootprints(SCH_SHEET_LIST &aSheetList)
Test if all units of each multiunit component have the same footprint assigned.
int RunERC()
Runs electrical rule checks on the connectivity graph.
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
Definition: sch_screen.h:491

References _, KIGFX::VIEW::Add(), SCH_SHEET_LIST::AnnotatePowerSymbols(), SCH_EDIT_FRAME::BuildNetListBase(), BUS, BUSLABELMEMBER, SCH_EDIT_FRAME::CheckAnnotate(), ERCE_BUS_ALIAS_CONFLICT, ERCE_DIFFERENT_UNIT_FP, ERCE_DIFFERENT_UNIT_NET, ERCE_DUPLICATE_SHEET_NAME, ERCE_SIMILAR_LABELS, g_ConnectionGraph, g_ErcSettings, g_RootSheet, SCH_BASE_FRAME::GetCanvas(), SCH_EDIT_FRAME::GetScreen(), SCH_DRAW_PANEL::GetView(), GLOBBUSLABELMEMBER, REPORTER::HasMessage(), ERC_SETTINGS::IsTestEnabled(), ITEM_UNSPECIFIED, SCH_SCREEN::Items(), JUNCTION, LABEL, m_markerProvider, m_markerTreeModel, m_parent, MARKER_BASE::MARKER_ERC, NO_CLEANUP, NOC, EE_RTREE::OfType(), PIN, PINLABEL, SCH_EDIT_FRAME::RecalculateConnections(), EDA_DRAW_PANEL_GAL::Refresh(), REPORTER::ReportTail(), RPT_SEVERITY_ERROR, RPT_SEVERITY_INFO, CONNECTION_GRAPH::RunERC(), SCH_MARKER_T, SEGMENT, MARKER_BASE::SetData(), RC_TREE_MODEL::SetProvider(), TestConflictingBusAliases(), TestDuplicateSheetNames(), TestMultiunitFootprints(), TestOthersItems(), and updateDisplayedCounts().

Referenced by OnRunERCClick().

◆ updateDisplayedCounts()

void DIALOG_ERC::updateDisplayedCounts ( )
private

Definition at line 96 of file dialog_erc.cpp.

97 {
98  int numErrors = 0;
99  int numWarnings = 0;
100  int numExcluded = 0;
101 
102  if( m_markerProvider )
103  {
107  }
108 
109  m_errorsBadge->SetBitmap( MakeBadge( RPT_SEVERITY_ERROR, numErrors, m_errorsBadge ) );
110  m_warningsBadge->SetBitmap( MakeBadge( RPT_SEVERITY_WARNING, numWarnings, m_warningsBadge ) );
112 }
RC_ITEMS_PROVIDER * m_markerProvider
Definition: dialog_erc.h:42
virtual int GetCount(int aSeverity=-1)=0
wxStaticBitmap * m_warningsBadge
wxStaticBitmap * m_errorsBadge
wxBitmap MakeBadge(SEVERITY aStyle, int aCount, wxWindow *aWindow, int aDepth)
Definition: ui_common.cpp:34
wxStaticBitmap * m_exclusionsBadge

References RC_ITEMS_PROVIDER::GetCount(), DIALOG_ERC_BASE::m_errorsBadge, DIALOG_ERC_BASE::m_exclusionsBadge, m_markerProvider, DIALOG_ERC_BASE::m_warningsBadge, MakeBadge(), RPT_SEVERITY_ERROR, RPT_SEVERITY_EXCLUSION, and RPT_SEVERITY_WARNING.

Referenced by DIALOG_ERC(), OnEraseDrcMarkersClick(), OnERCItemRClick(), OnSeverity(), and TestErc().

◆ VertPixelsFromDU()

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 165 of file dialog_shim.cpp.

166 {
167  wxSize sz( 0, y );
168  return ConvertDialogToPixels( sz ).y;
169 }

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT().

◆ writeReport()

bool DIALOG_ERC::writeReport ( const wxString &  aFullFileName)
private

Definition at line 566 of file dialog_erc.cpp.

567 {
568  wxFFile file( aFullFileName, wxT( "wt" ) );
569 
570  if( !file.IsOpened() )
571  return false;
572 
573  wxString msg = wxString::Format( _( "ERC report (%s, Encoding UTF8)\n" ), DateAndTime() );
574 
575  int err_count = 0;
576  int warn_count = 0;
577  int total_count = 0;
578  SCH_SHEET_LIST sheetList( g_RootSheet );
579 
580  for( unsigned i = 0; i < sheetList.size(); i++ )
581  {
582  msg << wxString::Format( _( "\n***** Sheet %s\n" ), sheetList[i].PathHumanReadable() );
583 
584  for( auto aItem : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
585  {
586  auto marker = static_cast<const SCH_MARKER*>( aItem );
587 
588  if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
589  continue;
590 
591  total_count++;
592 
593  switch( g_ErcSettings->m_Severities[ marker->GetRCItem()->GetErrorCode() ] )
594  {
595  case RPT_SEVERITY_ERROR: err_count++; break;
596  case RPT_SEVERITY_WARNING: warn_count++; break;
597  default: break;
598  }
599 
600  msg << marker->GetRCItem()->ShowReport( GetUserUnits() );
601  }
602  }
603 
604  msg << wxString::Format( _( "\n ** ERC messages: %d Errors %d Warnings %d\n" ),
605  total_count, err_count, warn_count );
606 
607  // Currently: write report using UTF8 (as usual in Kicad).
608  // TODO: see if we can use the current encoding page (mainly for Windows users),
609  // Or other format (HTML?)
610  file.Write( msg );
611 
612  // wxFFile dtor will close the file.
613 
614  return true;
615 }
SCH_SHEET_LIST.
EDA_UNITS GetUserUnits() const
Definition: dialog_shim.h:132
ERC_SETTINGS * g_ErcSettings
This also wants to live in the eventual SCHEMATIC object.
std::map< int, int > m_Severities
Definition: erc_settings.h:75
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
#define _(s)
Definition: 3d_actions.cpp:33
SCH_SHEET * g_RootSheet
wxString DateAndTime()
Definition: string.cpp:345

References _, DateAndTime(), Format(), g_ErcSettings, g_RootSheet, DIALOG_SHIM::GetUserUnits(), ERC_SETTINGS::m_Severities, MARKER_BASE::MARKER_ERC, RPT_SEVERITY_ERROR, RPT_SEVERITY_WARNING, and SCH_MARKER_T.

Referenced by OnSaveReport().

Member Data Documentation

◆ m_buttondelmarkers

wxButton* DIALOG_ERC_BASE::m_buttondelmarkers
protectedinherited

◆ m_buttonsSizer

wxBoxSizer* DIALOG_ERC_BASE::m_buttonsSizer
protectedinherited

Definition at line 58 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE().

◆ m_errorsBadge

wxStaticBitmap* DIALOG_ERC_BASE::m_errorsBadge
protectedinherited

Definition at line 51 of file dialog_erc_base.h.

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

◆ m_exclusionsBadge

wxStaticBitmap* DIALOG_ERC_BASE::m_exclusionsBadge
protectedinherited

Definition at line 55 of file dialog_erc_base.h.

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

◆ m_firstPaintEvent

bool DIALOG_SHIM::m_firstPaintEvent
protectedinherited

Definition at line 202 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

◆ m_hash_key

◆ m_initialFocusTarget

wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

Definition at line 203 of file dialog_shim.h.

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

◆ m_markerDataView

wxDataViewCtrl* DIALOG_ERC_BASE::m_markerDataView
protectedinherited

◆ m_markerProvider

RC_ITEMS_PROVIDER* DIALOG_ERC::m_markerProvider
private

Definition at line 42 of file dialog_erc.h.

Referenced by DIALOG_ERC(), OnERCItemRClick(), TestErc(), and updateDisplayedCounts().

◆ m_markerTreeModel

RC_TREE_MODEL* DIALOG_ERC::m_markerTreeModel
private

Definition at line 43 of file dialog_erc.h.

Referenced by deleteAllMarkers(), DIALOG_ERC(), OnSeverity(), TestErc(), and ~DIALOG_ERC().

◆ m_MessagesList

wxTextCtrl* DIALOG_ERC_BASE::m_MessagesList
protectedinherited

Definition at line 45 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE(), OnRunERCClick(), and OnSaveReport().

◆ m_parent

◆ m_qmodal_loop

WX_EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 205 of file dialog_shim.h.

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

◆ m_qmodal_parent_disabler

WDO_ENABLE_DISABLE* DIALOG_SHIM::m_qmodal_parent_disabler
protectedinherited

◆ m_qmodal_showing

bool DIALOG_SHIM::m_qmodal_showing
protectedinherited

Definition at line 207 of file dialog_shim.h.

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

◆ m_saveReport

wxButton* DIALOG_ERC_BASE::m_saveReport
protectedinherited

◆ m_sdbSizer1

wxStdDialogButtonSizer* DIALOG_ERC_BASE::m_sdbSizer1
protectedinherited

Definition at line 60 of file dialog_erc_base.h.

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

◆ m_sdbSizer1Cancel

wxButton* DIALOG_ERC_BASE::m_sdbSizer1Cancel
protectedinherited

◆ m_sdbSizer1OK

wxButton* DIALOG_ERC_BASE::m_sdbSizer1OK
protectedinherited

◆ m_severities

int DIALOG_ERC::m_severities
private

Definition at line 45 of file dialog_erc.h.

Referenced by DIALOG_ERC(), OnERCItemRClick(), OnSeverity(), syncCheckboxes(), and ~DIALOG_ERC().

◆ m_showAll

wxCheckBox* DIALOG_ERC_BASE::m_showAll
protectedinherited

◆ m_showErrors

wxCheckBox* DIALOG_ERC_BASE::m_showErrors
protectedinherited

◆ m_showExclusions

wxCheckBox* DIALOG_ERC_BASE::m_showExclusions
protectedinherited

◆ m_showLabel

wxStaticText* DIALOG_ERC_BASE::m_showLabel
protectedinherited

Definition at line 48 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE().

◆ m_showWarnings

wxCheckBox* DIALOG_ERC_BASE::m_showWarnings
protectedinherited

◆ m_staticline1

wxStaticLine* DIALOG_ERC_BASE::m_staticline1
protectedinherited

Definition at line 57 of file dialog_erc_base.h.

Referenced by DIALOG_ERC_BASE::DIALOG_ERC_BASE().

◆ m_tabOrder

◆ m_textMarkers

wxStaticText* DIALOG_ERC_BASE::m_textMarkers
protectedinherited

Definition at line 46 of file dialog_erc_base.h.

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

◆ m_titleMessages

wxStaticText* DIALOG_ERC_BASE::m_titleMessages
protectedinherited

Definition at line 44 of file dialog_erc_base.h.

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

◆ m_units

◆ m_warningsBadge

wxStaticBitmap* DIALOG_ERC_BASE::m_warningsBadge
protectedinherited

Definition at line 53 of file dialog_erc_base.h.

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


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