45 #include <wx/filedlg.h> 46 #include <wx/hyperlink.h> 114 wxHyperlinkCtrl* button =
new wxHyperlinkCtrl(
m_infoBar, wxID_ANY,
115 _(
"Show Annotation dialog"),
118 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<
void( wxHyperlinkEvent& aEvent )>(
119 [&]( wxHyperlinkEvent& aEvent )
121 wxHtmlLinkEvent htmlEvent( aEvent.GetId(),
122 wxHtmlLinkInfo( aEvent.GetURL() ) );
129 "ERC results will be incomplete." ) );
202 bool includeExclusions =
false;
208 if( numExcluded > 0 )
210 wxMessageDialog dlg(
this,
_(
"Delete exclusions too?" ),
_(
"Delete All Markers" ),
211 wxYES_NO | wxCANCEL | wxCENTER | wxICON_QUESTION );
212 dlg.SetYesNoLabels(
_(
"Errors and Warnings Only" ) ,
_(
"Errors, Warnings and Exclusions" ) );
214 int ret = dlg.ShowModal();
216 if( ret == wxID_CANCEL )
218 else if( ret == wxID_NO )
219 includeExclusions =
true;
267 wxCommandEvent
dummy;
299 ercItem->SetErrorMessage( aMsg );
304 ercItem->SetItems( aItemA->
GetSymbol() );
312 if( itemsNotAnnotated )
418 AdvancePhase(
_(
"Checking no connect pins for connections..." ) );
424 AdvancePhase(
_(
"Checking for library symbol issues..." ) );
450 if( item && item->
GetClass() != wxT(
"DELETED_SHEET_ITEM" ) )
474 if( aEvent.GetItem().IsOk() )
495 std::shared_ptr<RC_ITEM> rcItem = node->
m_RcItem;
500 switch( settings.
GetSeverity( rcItem->GetErrorCode() ) )
504 default: listName =
_(
"appropriate" );
break;
507 if( rcItem->GetParent()->IsExcluded() )
509 menu.Append( 1,
_(
"Remove exclusion for this violation" ),
514 menu.Append( 2,
_(
"Exclude this violation" ),
518 menu.AppendSeparator();
527 menu.Append( 4,
wxString::Format(
_(
"Change severity to Error for all '%s' violations" ),
528 rcItem->GetErrorText() ),
529 _(
"Violation severities can also be edited in the Board Setup... dialog" ) );
533 menu.Append( 5,
wxString::Format(
_(
"Change severity to Warning for all '%s' violations" ),
534 rcItem->GetErrorText() ),
535 _(
"Violation severities can also be edited in the Board Setup... dialog" ) );
538 menu.Append( 6,
wxString::Format(
_(
"Ignore all '%s' violations" ), rcItem->GetErrorText() ),
539 _(
"Violations will not be checked or reported" ) );
541 menu.AppendSeparator();
546 menu.Append( 7,
_(
"Edit pin-to-pin conflict map..." ) );
550 menu.Append( 8,
_(
"Edit violation severities..." ),
551 _(
"Open the Schematic Setup... dialog" ) );
554 bool modified =
false;
556 switch( GetPopupMenuSelectionFromUser( menu ) )
568 static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
585 static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
587 static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->DeleteCurrentItem(
false );
599 SCH_MARKER* marker = static_cast<SCH_MARKER*>( item );
601 if( marker->
GetRCItem()->GetErrorCode() == rcItem->GetErrorCode() )
606 static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider(
m_markerProvider );
615 SCH_MARKER* marker = static_cast<SCH_MARKER*>( item );
617 if( marker->
GetRCItem()->GetErrorCode() == rcItem->GetErrorCode() )
622 static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider(
m_markerProvider );
637 static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider(
m_markerProvider );
682 if( marker !=
nullptr )
691 marker = dynamic_cast<SCH_MARKER*>( node->
m_RcItem->GetParent() );
715 if( aEvent.GetEventObject() ==
m_showAll )
724 if( aEvent.IsChecked() )
726 else if( aEvent.GetEventObject() ==
m_showAll )
758 wxFileDialog dlg(
this,
_(
"Save Report to File" ),
Prj().GetProjectPath(), fn.GetFullName(),
761 if( dlg.ShowModal() != wxID_OK )
766 if( fn.GetExt().IsEmpty() )
769 if( !fn.IsAbsolute() )
772 fn.MakeAbsolute( prj_path );
778 fn.GetFullPath() ) );
783 fn.GetFullPath() ) );
790 wxFFile file( aFullFileName, wxT(
"wt" ) );
792 if( !file.IsOpened() )
797 std::map<KIID, EDA_ITEM*> itemMap;
808 for(
unsigned i = 0; i < sheetList.size(); i++ )
810 msg <<
wxString::Format(
_(
"\n***** Sheet %s\n" ), sheetList[i].PathHumanReadable() );
814 const SCH_MARKER* marker = static_cast<const SCH_MARKER*>( aItem );
835 total_count, err_count, warn_count );
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
void ExcludeMarker(SCH_MARKER *aMarker=nullptr)
Exclude aMarker from the ERC list.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
void DeleteItems(bool aCurrentOnly, bool aIncludeExclusions, bool aDeep)
Deletes the current item or all items.
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
EE_TYPE OfType(KICAD_T aType) const
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
void deleteAllMarkers(bool aIncludeExclusions)
void OnERCItemRClick(wxDataViewEvent &aEvent) override
void AddButton(wxButton *aButton)
Add an already created button to the infobar.
void OnCancelClick(wxCommandEvent &event) override
wxButton * m_buttondelmarkers
void DeleteMarkers(enum MARKER_BASE::TYPEMARKER aMarkerTyp, int aErrorCode, bool aIncludeExclusions=true)
Delete all markers of a particular type and error code.
Different units of the same symbol have different footprints assigned.
virtual void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
NUMBER_BADGE * m_errorsBadge
void SetProvider(RC_ITEMS_PROVIDER *aProvider)
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generate the connection data for the entire schematic hierarchy.
int TestMultUnitPinConflicts()
Checks if shared pins on multi-unit symbols have been connected to different nets.
Power input pin connected to some others pins but no power out pin to drive it.
RC_TREE_MODEL * m_markerTreeModel
Holds all the data relating to one schematic.
CONNECTION_GRAPH * ConnectionGraph() const override
This file is part of the common library.
void Clear()
Delete the stored messages.
void TestTextVars(DS_PROXY_VIEW_ITEM *aDrawingSheet)
Check for any unresolved text variable references.
const SCH_SHEET_PATH & GetSheetPath() const
virtual void AdvancePhase() override
Use the next available virtual zone of the dialog progress bar.
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
static std::shared_ptr< ERC_ITEM > Create(int aErrorCode)
Constructs an ERC_ITEM for the given error code.
void OnLinkClicked(wxHtmlLinkEvent &event) override
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
bool writeReport(const wxString &aFullFileName)
void OnEraseDrcMarkersClick(wxCommandEvent &event) override
void UpdateNumber(int aNumber, SEVERITY aSeverity)
Update the number displayed on the badge.
static TOOL_ACTION cancelInteractive
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
RC_ITEMS_PROVIDER * m_markerProvider
void ResolveERCExclusions()
Update markers to match recorded exclusions.
wxCheckBox * m_showExclusions
void updateDisplayedCounts()
Schematic editor (Eeschema) main window.
static KIID ToUUID(wxDataViewItem aItem)
SCH_SYMBOL * GetSymbol() const
void DisplayCurrentSheet()
Draw the current sheet on the display.
void OnSeverity(wxCommandEvent &aEvent) override
virtual int GetCount(int aSeverity=-1) const =0
An implementation of the RC_ITEM_LIST interface which uses the global SHEETLIST to fulfill the contra...
int CheckAnnotate(ANNOTATION_ERROR_HANDLER aErrorHandler, ANNOTATE_SCOPE_T aAnnotateScope=ANNOTATE_ALL)
Check for annotation errors.
void SetSeverity(int aErrorCode, SEVERITY aSeverity)
wxButton * m_sdbSizer1Cancel
virtual const wxString GetProjectPath() const
Return the full path of the project.
static int RPT_SEVERITY_ALL
Library symbol changed from current symbol in schematic or the library symbol link no longer valid.
void DeleteCurrentItem(bool aDeep)
void SetSeverities(int aSeverities)
#define DIALOG_ERC_WINDOW_NAME
EDA_UNITS GetUserUnits() const
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void FillItemMap(std::map< KIID, EDA_ITEM * > &aMap)
Fill an item cache for temporary use when many items need to be fetched.
void Report(const wxString &aMessage) override
Display aMessage in the progress bar dialog.
void SetImmediateMode()
In immediate mode, messages are flushed as they are added.
void SetExcluded(bool aExcluded)
int TestConflictingBusAliases()
Check that there are no conflicting bus alias definitions in the schematic.
std::shared_ptr< RC_ITEM > m_RcItem
Pin connected to some others pins but no pin to drive it.
static RC_TREE_NODE * ToNode(wxDataViewItem aItem)
wxString ReportFileWildcard()
int TestMultiunitFootprints()
Test if all units of each multiunit symbol have the same footprint assigned.
wxStdDialogButtonSizer * m_sdbSizer1
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void UpdateAnnotationWarning()
Shared pin in a multi-unit symbol is connected to more than one net.
2 labels are equal for case insensitive comparisons.
SCHEMATIC & Schematic() const
Definition of file extensions used in Kicad.
void SelectMarker(const MARKER_BASE *aMarker)
DIALOG_ERC(SCH_EDIT_FRAME *parent)
static TOOL_ACTION clearSelection
Clears the current selection.
Container for ERC settings.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void OnERCItemSelected(wxDataViewEvent &aEvent) override
SCH_EDIT_FRAME * m_parent
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
bool Show(bool show) override
void OnCloseErcDialog(wxCloseEvent &event) override
NUMBER_BADGE * m_warningsBadge
This implements all the tricky bits for thread safety, but the GUI is left to derived classes.
void OnERCItemDClick(wxDataViewEvent &aEvent) override
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
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.
void OnAnnotate(wxCommandEvent &event)
SCH_ITEM * GetItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr) const
Fetch a SCH_ITEM by ID.
wxCheckBox * m_showWarnings
A text variable could not be resolved.
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
A no connect symbol is connected to more than 1 pin.
int TestLibSymbolIssues()
Test symbols for changed library symbols and broken symbol library links.
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
wxCheckBox * m_showErrors
NUMBER_BADGE * m_exclusionsBadge
SCH_SCREEN * LastScreen()
wxDataViewCtrl * m_markerDataView
void Append(SCH_ITEM *aItem)
enum TYPEMARKER GetMarkerType() const
const std::string ReportFileExtension
int TestPinToPin()
Checks the full netlist against the pin-to-pin connectivity requirements.
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
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...
std::atomic_bool m_cancelled
Conflicting bus alias definitions across sheets.
wxPoint GetPosition() const override
void OnSaveReport(wxCommandEvent &aEvent) override
virtual wxString GetClass() const override
Return the class name.
WX_HTML_REPORT_BOX * m_messages
SCH_SHEET_PATH & GetCurrentSheet() const
void FocusOnItem(SCH_ITEM *aItem)
void AnnotatePowerSymbols()
Silently annotate the not yet annotated power symbols of the entire hierarchy of the sheet path list.
void ValueChanged(const RC_TREE_NODE *aNode)
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
VECTOR2D m_ScrollCenter
Current scroll center point in logical units.
DS_PROXY_VIEW_ITEM * GetDrawingSheet() const
virtual void SetCurrentProgress(double aProgress) override
Set the progress value to aProgress (0..1).
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
ERC_SETTINGS & ErcSettings() const
int TestSimilarLabels()
Checks for labels that differ only in capitalization.
Duplicate sheet names within a given sheet.
void ShowSchematicSetupDialog(const wxString &aInitialPage=wxEmptyString)
void SetMaximumNumber(int aMax)
Set the maximum number to be shown on the badge.
Base class for any item which can be embedded within the SCHEMATIC container class,...
int TestNoConnectPins()
In KiCad 5 and earlier, you could connect stuff up to pins with NC electrical type.
void RecordERCExclusions()
Scan existing markers and record data from any that are Excluded.
int RunERC()
Runs electrical rule checks on the connectivity graph.
std::shared_ptr< RC_ITEM > GetRCItem() const
A helper to define a symbol's reference designator in a schematic.
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
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...
int TestDuplicateSheetNames(bool aCreateMarker)
Inside a given sheet, one cannot have sheets with duplicate names (file names can be duplicated).
SEVERITY GetSeverity(int aErrorCode) const
void OnRunERCClick(wxCommandEvent &event) override