44#include <wx/filedlg.h>
45#include <wx/hyperlink.h>
66 m_markerTreeModel( nullptr ),
69 m_centerMarkerOnIdle( nullptr ),
100 { wxID_CANCEL,
_(
"Close" ) } } );
134 wxASSERT( settings );
150 wxHyperlinkCtrl* button =
new wxHyperlinkCtrl(
m_infoBar, wxID_ANY,
151 _(
"Show Annotation dialog" ),
154 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<
void( wxHyperlinkEvent& aEvent )>(
155 [&]( wxHyperlinkEvent& aEvent )
157 wxHtmlLinkEvent htmlEvent( aEvent.GetId(),
158 wxHtmlLinkInfo( aEvent.GetURL() ) );
165 "ERC results will be incomplete." ) );
225 bool markersOverflowed =
false;
234 num.Printf( markersOverflowed ? wxT(
"%d+" ) : wxT(
"%d" ), numMarkers );
240 msg.Replace( wxT(
"(%s)" ), wxEmptyString );
253 msg.Replace( wxT(
"(%s)" ), wxEmptyString );
291 bool includeExclusions =
false;
297 if( numExcluded > 0 )
299 wxMessageDialog dlg(
this,
_(
"Delete exclusions too?" ),
_(
"Delete All Markers" ),
300 wxYES_NO | wxCANCEL | wxCENTER | wxICON_QUESTION );
301 dlg.SetYesNoLabels(
_(
"Errors and Warnings Only" ),
302 _(
"Errors, Warnings and Exclusions" ) );
304 int ret = dlg.ShowModal();
306 if( ret == wxID_CANCEL )
308 else if( ret == wxID_NO )
309 includeExclusions =
true;
357 wxCommandEvent
dummy;
376 for( std::reference_wrapper<RC_ITEM>& item : violations )
381 wxT(
" • " ) + item.get().GetErrorText() );
404 ercItem->SetErrorMessage( aMsg );
409 ercItem->SetItems( aItemA->
GetSymbol() );
417 if( itemsNotAnnotated )
541 AdvancePhase(
_(
"Checking no connect pins for connections..." ) );
547 AdvancePhase(
_(
"Checking for library symbol issues..." ) );
553 AdvancePhase(
_(
"Checking for off grid pins and wires..." ) );
584 else if( item && item->
GetClass() != wxT(
"DELETED_SHEET_ITEM" ) )
591 std::shared_ptr<ERC_ITEM> ercItem =
592 std::static_pointer_cast<ERC_ITEM>( node->
m_RcItem );
596 if( ercItem->IsSheetSpecific() )
597 sheet = ercItem->GetSpecificSheetPath();
600 if( ercItem->MainItemHasSheetPath() )
601 sheet = ercItem->GetMainItemSheetPath();
604 if( ercItem->AuxItemHasSheetPath() )
605 sheet = ercItem->GetAuxItemSheetPath();
634 if( aEvent.GetItem().IsOk() )
655 std::shared_ptr<RC_ITEM> rcItem = node->
m_RcItem;
659 switch( settings.
GetSeverity( rcItem->GetErrorCode() ) )
663 default: listName =
_(
"appropriate" );
break;
666 if( rcItem->GetParent()->IsExcluded() )
668 menu.Append( 1,
_(
"Remove exclusion for this violation" ),
673 menu.Append( 2,
_(
"Exclude this violation" ),
677 menu.AppendSeparator();
686 menu.Append( 4,
wxString::Format(
_(
"Change severity to Error for all '%s' violations" ),
687 rcItem->GetErrorText() ),
688 _(
"Violation severities can also be edited in the Board Setup... dialog" ) );
692 menu.Append( 5,
wxString::Format(
_(
"Change severity to Warning for all '%s' violations" ),
693 rcItem->GetErrorText() ),
694 _(
"Violation severities can also be edited in the Board Setup... dialog" ) );
697 menu.Append( 6,
wxString::Format(
_(
"Ignore all '%s' violations" ), rcItem->GetErrorText() ),
698 _(
"Violations will not be checked or reported" ) );
700 menu.AppendSeparator();
705 menu.Append( 7,
_(
"Edit pin-to-pin conflict map..." ) );
709 menu.Append( 8,
_(
"Edit violation severities..." ),
710 _(
"Open the Schematic Setup... dialog" ) );
713 bool modified =
false;
715 switch( GetPopupMenuSelectionFromUser( menu ) )
727 static_cast<RC_TREE_MODEL*
>( aEvent.GetModel() )->ValueChanged( node );
744 static_cast<RC_TREE_MODEL*
>( aEvent.GetModel() )->ValueChanged( node );
746 static_cast<RC_TREE_MODEL*
>( aEvent.GetModel() )->DeleteCurrentItem(
false );
760 if( marker->
GetRCItem()->GetErrorCode() == rcItem->GetErrorCode() )
776 if( marker->
GetRCItem()->GetErrorCode() == rcItem->GetErrorCode() )
870 if( marker !=
nullptr )
903 menu.Append( 1,
_(
"Edit ignored violations..." ),
_(
"Open the Schematic Setup... dialog" ) );
905 switch( GetPopupMenuSelectionFromUser( menu ) )
918 if( aEvent.GetEventObject() ==
m_showAll )
927 if( aEvent.IsChecked() )
929 else if( aEvent.GetEventObject() ==
m_showAll )
957 wxFileDialog dlg(
this,
_(
"Save Report to File" ),
Prj().GetProjectPath(), fn.GetFullName(),
960 if( dlg.ShowModal() != wxID_OK )
965 if( fn.GetExt().IsEmpty() )
968 if( !fn.IsAbsolute() )
971 fn.MakeAbsolute( prj_path );
977 fn.GetFullPath() ) );
982 fn.GetFullPath() ) );
989 wxFFile file( aFullFileName, wxT(
"wt" ) );
991 if( !file.IsOpened() )
996 std::map<KIID, EDA_ITEM*> itemMap;
1000 int total_count = 0;
1007 for(
unsigned i = 0; i < sheetList.size(); i++ )
1009 msg <<
wxString::Format(
_(
"\n***** Sheet %s\n" ), sheetList[i].PathHumanReadable() );
1034 total_count, err_count, warn_count );
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
static TOOL_ACTION cancelInteractive
VECTOR2D m_ScrollCenter
Current scroll center point in logical units.
int RunERC()
Runs electrical rule checks on the connectivity graph.
wxButton * m_sdbSizer1Cancel
wxSimplebook * m_runningResultsBook
wxCheckBox * m_showExclusions
NUMBER_BADGE * m_errorsBadge
wxCheckBox * m_showErrors
NUMBER_BADGE * m_exclusionsBadge
wxListCtrl * m_ignoredList
WX_HTML_REPORT_BOX * m_messages
wxDataViewCtrl * m_markerDataView
wxButton * m_deleteAllMarkers
NUMBER_BADGE * m_warningsBadge
wxButton * m_deleteOneMarker
wxCheckBox * m_showWarnings
void ExcludeMarker(SCH_MARKER *aMarker=nullptr)
Exclude aMarker from the ERC list.
const SCH_MARKER * m_centerMarkerOnIdle
void OnERCItemDClick(wxDataViewEvent &aEvent) override
std::shared_ptr< RC_ITEMS_PROVIDER > m_markerProvider
DIALOG_ERC(SCH_EDIT_FRAME *parent)
void SelectMarker(const SCH_MARKER *aMarker)
SCH_EDIT_FRAME * m_parent
void OnIgnoreItemRClick(wxListEvent &event) override
wxString m_violationsTitleTemplate
void OnERCItemRClick(wxDataViewEvent &aEvent) override
bool writeReport(const wxString &aFullFileName)
void centerMarkerIdleHandler(wxIdleEvent &aEvent)
void OnDeleteAllClick(wxCommandEvent &event) override
void OnLinkClicked(wxHtmlLinkEvent &event) override
void OnRunERCClick(wxCommandEvent &event) override
void deleteAllMarkers(bool aIncludeExclusions)
wxString m_ignoredTitleTemplate
void OnDeleteOneClick(wxCommandEvent &event) override
void OnSaveReport(wxCommandEvent &aEvent) override
SCHEMATIC * m_currentSchematic
void UpdateAnnotationWarning()
void Report(const wxString &aMessage) override
Display aMessage in the progress bar dialog.
void OnERCItemSelected(wxDataViewEvent &aEvent) override
RC_TREE_MODEL * m_markerTreeModel
void updateDisplayedCounts()
void OnSeverity(wxCommandEvent &aEvent) override
void OnCloseErcDialog(wxCloseEvent &event) override
void OnCancelClick(wxCommandEvent &event) override
bool Show(bool show) override
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
static TOOL_ACTION clearSelection
Clears the current selection.
EE_TYPE OfType(KICAD_T aType) const
static std::shared_ptr< ERC_ITEM > Create(int aErrorCode)
Constructs an ERC_ITEM for the given error code.
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
Container for ERC settings.
bool IsTestEnabled(int aErrorCode) const
SEVERITY GetSeverity(int aErrorCode) const
void SetSeverity(int aErrorCode, SEVERITY aSeverity)
int TestLibSymbolIssues()
Test symbols for changed library symbols and broken symbol library links.
void TestTextVars(DS_PROXY_VIEW_ITEM *aDrawingSheet)
Check for any unresolved text variable references.
int TestPinToPin()
Checks the full netlist against the pin-to-pin connectivity requirements.
int TestSimilarLabels()
Checks for labels that differ only in capitalization.
int TestDuplicateSheetNames(bool aCreateMarker)
Inside a given sheet, one cannot have sheets with duplicate names (file names can be duplicated).
int TestMultUnitPinConflicts()
Checks if shared pins on multi-unit symbols have been connected to different nets.
int TestOffGridEndpoints(int aGridSize)
Test pins and wire ends for being off grid.
int TestConflictingBusAliases()
Check that there are no conflicting bus alias definitions in the schematic.
int TestNoConnectPins()
In KiCad 5 and earlier, you could connect stuff up to pins with NC electrical type.
int TestSimModelIssues()
Test SPICE models for various issues.
int TestMissingUnits()
Test for uninstantiated units of multi unit symbols.
int TestMultiunitFootprints()
Test if all units of each multiunit symbol have the same footprint assigned.
A specialisation of the RC_TREE_MODEL class to enable ERC errors / warnings to be resolved in a speci...
APP_SETTINGS_BASE * KifaceSettings() const
const VECTOR2D & GetGridSize() const
Return the grid size.
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
std::shared_ptr< RC_ITEM > GetRCItem() const
enum TYPEMARKER GetMarkerType() const
void SetExcluded(bool aExcluded)
void SetMaximumNumber(int aMax)
Set the maximum number to be shown on the badge.
void UpdateNumber(int aNumber, SEVERITY aSeverity)
Update the number displayed on the badge.
This implements all the tricky bits for thread safety, but the GUI is left to derived classes.
virtual void AdvancePhase() override
Use the next available virtual zone of the dialog progress bar.
virtual void SetCurrentProgress(double aProgress) override
Set the progress value to aProgress (0..1).
std::atomic_bool m_cancelled
virtual const wxString GetProjectPath() const
Return the full path of the project.
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
void SelectMarker(const MARKER_BASE *aMarker)
static RC_TREE_NODE * ToNode(wxDataViewItem aItem)
void Update(std::shared_ptr< RC_ITEMS_PROVIDER > aProvider, int aSeverities)
void DeleteItems(bool aCurrentOnly, bool aIncludeExclusions, bool aDeep)
Deletes the current item or all items.
void DeleteCurrentItem(bool aDeep)
void CenterMarker(const MARKER_BASE *aMarker)
static KIID ToUUID(wxDataViewItem aItem)
void ValueChanged(const RC_TREE_NODE *aNode)
std::shared_ptr< RC_ITEM > m_RcItem
virtual REPORTER & ReportHead(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Places the report at the beginning of the list for objects that support ordering.
Holds all the data relating to one schematic.
CONNECTION_GRAPH * ConnectionGraph() const override
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
ERC_SETTINGS & ErcSettings() const
virtual void RedrawScreen(const VECTOR2I &aCenterPoint, bool aWarpPointer)
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
Schematic editor (Eeschema) main window.
void ShowSchematicSetupDialog(const wxString &aInitialPage=wxEmptyString)
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag and update other data struc...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void RecordERCExclusions()
Scan existing markers and record data from any that are Excluded.
SCH_SHEET_PATH & GetCurrentSheet() const
SCHEMATIC & Schematic() const
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generate the connection data for the entire schematic hierarchy.
void OnAnnotate(wxCommandEvent &event)
int CheckAnnotate(ANNOTATION_ERROR_HANDLER aErrorHandler, ANNOTATE_SCOPE_T aAnnotateScope=ANNOTATE_ALL, bool aRecursive=true)
Check for annotation errors.
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
void DisplayCurrentSheet()
Draw the current sheet on the display.
void ResolveERCExclusions()
Update markers to match recorded exclusions.
void FocusOnItem(SCH_ITEM *aItem)
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual wxString GetClass() const override
Return the class name.
A helper to define a symbol's reference designator in a schematic.
const SCH_SHEET_PATH & GetSheetPath() const
SCH_SYMBOL * GetSymbol() const
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
void DeleteMarkers(enum MARKER_BASE::TYPEMARKER aMarkerTyp, int aErrorCode, bool aIncludeExclusions=true)
Delete all markers of a particular type and error code.
void DeleteAllMarkers(enum MARKER_BASE::TYPEMARKER aMarkerType, bool aIncludeExclusions)
Delete all electronic rules check markers of aMarkerType from all the screens in the list.
void Append(SCH_ITEM *aItem, bool aUpdateLibSymbol=true)
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
SCH_ITEM * GetItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr) const
Fetch a SCH_ITEM by ID.
void FillItemMap(std::map< KIID, EDA_ITEM * > &aMap)
Fill an item cache for temporary use when many items need to be fetched.
void AnnotatePowerSymbols()
Silently annotate the not yet annotated power symbols of the entire hierarchy of the sheet path list.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
bool empty() const
Forwarded method from std::vector.
SCH_SCREEN * LastScreen()
VECTOR2I GetPosition() const override
void Clear()
Delete the stored messages.
void SetImmediateMode()
In immediate mode, messages are flushed as they are added.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
void AddButton(wxButton *aButton)
Add an already created button to the infobar.
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
This file is part of the common library.
static int RPT_SEVERITY_ALL
static std::vector< wxString > g_lastERCIgnored
static int DEFAULT_SINGLE_COL_WIDTH
static SCHEMATIC * g_lastERCSchematic
#define DIALOG_ERC_WINDOW_NAME
@ ERCE_POWERPIN_NOT_DRIVEN
Power input pin connected to some others pins but no power out pin to drive it.
@ ERCE_MISSING_POWER_INPUT_PIN
Symbol has power input pins that are not placed on the schematic.
@ ERCE_SIMILAR_LABELS
2 labels are equal for case insensitive comparisons.
@ ERCE_ENDPOINT_OFF_GRID
Pin or wire-end off grid.
@ ERCE_DIFFERENT_UNIT_NET
Shared pin in a multi-unit symbol is connected to more than one net.
@ ERCE_UNRESOLVED_VARIABLE
A text variable could not be resolved.
@ ERCE_SIMULATION_MODEL
An error was found in the simulation model.
@ ERCE_DIFFERENT_UNIT_FP
Different units of the same symbol have different footprints assigned.
@ ERCE_NOCONNECT_CONNECTED
A no connect symbol is connected to more than 1 pin.
@ ERCE_PIN_TO_PIN_WARNING
@ ERCE_PIN_NOT_DRIVEN
Pin connected to some others pins but no pin to drive it.
@ ERCE_MISSING_INPUT_PIN
Symbol has input pins that are not placed.
@ ERCE_MISSING_UNIT
Symbol has units that are not placed on the schematic.
@ ERCE_DUPLICATE_SHEET_NAME
Duplicate sheet names within a given sheet.
@ ERCE_MISSING_BIDI_PIN
Symbol has bi-directional pins that are not placed.
@ ERCE_LIB_SYMBOL_ISSUES
Library symbol changed from current symbol in schematic or the library symbol link no longer valid.
@ ERCE_BUS_ALIAS_CONFLICT
Conflicting bus alias definitions across sheets.
const std::string ReportFileExtension
wxString ReportFileWildcard()
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
std::vector< FAB_LAYER_COLOR > dummy
Definition of file extensions used in Kicad.