Move ERC error reporting over to the new framework.
Fixes https://gitlab.com/kicad/code/kicad/issues/1989
This commit is contained in:
parent
222b222299
commit
cee973dc04
|
@ -327,6 +327,7 @@ set( COMMON_SRCS
|
|||
project.cpp
|
||||
properties.cpp
|
||||
ptree.cpp
|
||||
rc_item.cpp
|
||||
refdes_utils.cpp
|
||||
reporter.cpp
|
||||
richio.cpp
|
||||
|
|
|
@ -23,15 +23,17 @@
|
|||
|
||||
#include <widgets/paged_dialog.h>
|
||||
#include <widgets/ui_common.h>
|
||||
#include <drc_item.h>
|
||||
#include <rc_item.h>
|
||||
#include "panel_setup_severities.h"
|
||||
|
||||
|
||||
PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent,
|
||||
PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent, RC_ITEM& aDummyItem,
|
||||
std::map<int, int>& aSeverities,
|
||||
int aFirstErrorCode, int aLastErrorCode ) :
|
||||
wxPanel( aParent->GetTreebook() ),
|
||||
m_severities( aSeverities )
|
||||
m_severities( aSeverities ),
|
||||
m_firstErrorCode( aFirstErrorCode ),
|
||||
m_lastErrorCode( aLastErrorCode )
|
||||
{
|
||||
wxString severities[] = { _( "Error" ), _( "Warning" ), _( "Ignore" ) };
|
||||
int baseID = 1000;
|
||||
|
@ -44,10 +46,10 @@ PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent,
|
|||
wxFlexGridSizer* gridSizer = new wxFlexGridSizer( 0, 2, 0, 5 );
|
||||
gridSizer->SetFlexibleDirection( wxBOTH );
|
||||
|
||||
for( int errorCode = aFirstErrorCode; errorCode <= aLastErrorCode; ++errorCode )
|
||||
for( int errorCode = m_firstErrorCode; errorCode <= m_lastErrorCode; ++errorCode )
|
||||
{
|
||||
DRC_ITEM drcItem( errorCode, wxEmptyString );
|
||||
wxString msg = drcItem.GetErrorText();
|
||||
aDummyItem.SetData( errorCode, wxEmptyString );
|
||||
wxString msg = aDummyItem.GetErrorText();
|
||||
|
||||
if( !msg.IsEmpty() )
|
||||
{
|
||||
|
@ -61,14 +63,13 @@ PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent,
|
|||
|
||||
for( size_t i = 0; i < sizeof( severities ) / sizeof( wxString ); ++i )
|
||||
{
|
||||
m_buttonMap[errorCode][i] = new wxRadioButton( radioPanel,
|
||||
baseID + errorCode * 10 + i,
|
||||
severities[i],
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
i == 0 ? wxRB_GROUP : 0 );
|
||||
radioSizer->Add( m_buttonMap[errorCode][i], 1,
|
||||
wxRIGHT | wxEXPAND, 25 );
|
||||
m_buttonMap[ errorCode ][i] = new wxRadioButton( radioPanel,
|
||||
baseID + errorCode * 10 + i,
|
||||
severities[i],
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
i == 0 ? wxRB_GROUP : 0 );
|
||||
radioSizer->Add( m_buttonMap[ errorCode ][i], 1, wxRIGHT | wxEXPAND, 25 );
|
||||
}
|
||||
|
||||
radioPanel->SetSizer( radioSizer );
|
||||
|
@ -90,16 +91,14 @@ PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent,
|
|||
|
||||
void PANEL_SETUP_SEVERITIES::ImportSettingsFrom( std::map<int, int>& aSettings )
|
||||
{
|
||||
for( auto const& entry : aSettings )
|
||||
for( int errorCode = m_firstErrorCode; errorCode <= m_lastErrorCode; ++errorCode )
|
||||
{
|
||||
if( m_buttonMap.count( entry.first ) )
|
||||
switch( aSettings[ errorCode ] )
|
||||
{
|
||||
switch( entry.second )
|
||||
{
|
||||
case RPT_SEVERITY_ERROR: m_buttonMap[entry.first][0]->SetValue( true ); break;
|
||||
case RPT_SEVERITY_WARNING: m_buttonMap[entry.first][1]->SetValue( true ); break;
|
||||
case RPT_SEVERITY_IGNORE: m_buttonMap[entry.first][2]->SetValue( true ); break;
|
||||
}
|
||||
case RPT_SEVERITY_ERROR: m_buttonMap[ errorCode ][0]->SetValue( true ); break;
|
||||
case RPT_SEVERITY_WARNING: m_buttonMap[ errorCode ][1]->SetValue( true ); break;
|
||||
case RPT_SEVERITY_IGNORE: m_buttonMap[ errorCode ][2]->SetValue( true ); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,16 +106,14 @@ void PANEL_SETUP_SEVERITIES::ImportSettingsFrom( std::map<int, int>& aSettings )
|
|||
|
||||
bool PANEL_SETUP_SEVERITIES::TransferDataToWindow()
|
||||
{
|
||||
for( auto const& entry : m_severities )
|
||||
for( int errorCode = m_firstErrorCode; errorCode <= m_lastErrorCode; ++errorCode )
|
||||
{
|
||||
if( m_buttonMap.count( entry.first ) )
|
||||
switch( m_severities[ errorCode ] )
|
||||
{
|
||||
switch( entry.second )
|
||||
{
|
||||
case RPT_SEVERITY_ERROR: m_buttonMap[entry.first][0]->SetValue( true ); break;
|
||||
case RPT_SEVERITY_WARNING: m_buttonMap[entry.first][1]->SetValue( true ); break;
|
||||
case RPT_SEVERITY_IGNORE: m_buttonMap[entry.first][2]->SetValue( true ); break;
|
||||
}
|
||||
case RPT_SEVERITY_ERROR: m_buttonMap[ errorCode ][0]->SetValue( true ); break;
|
||||
case RPT_SEVERITY_WARNING: m_buttonMap[ errorCode ][1]->SetValue( true ); break;
|
||||
case RPT_SEVERITY_IGNORE: m_buttonMap[ errorCode ][2]->SetValue( true ); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,12 +38,14 @@ class PANEL_SETUP_SEVERITIES : public wxPanel
|
|||
{
|
||||
private:
|
||||
std::map<int, int>& m_severities;
|
||||
int m_firstErrorCode;
|
||||
int m_lastErrorCode;
|
||||
|
||||
std::map<int, wxRadioButton*[4]> m_buttonMap; // map from DRC error code to button group
|
||||
|
||||
public:
|
||||
PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent, std::map<int, int>& aSeverities,
|
||||
int aFirstErrorCode, int aLastErrorCode );
|
||||
~PANEL_SETUP_SEVERITIES( ) { };
|
||||
PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent, RC_ITEM& aDummyItem,
|
||||
std::map<int, int>& aSeverities, int aFirstError, int aLastError );
|
||||
|
||||
void ImportSettingsFrom( std::map<int, int>& aSettings );
|
||||
|
||||
|
|
|
@ -58,20 +58,18 @@ static const VECTOR2I MarkerShapeCorners[] =
|
|||
};
|
||||
const unsigned CORNERS_COUNT = arrayDim( MarkerShapeCorners );
|
||||
|
||||
/*******************/
|
||||
/* Classe MARKER_BASE */
|
||||
/*******************/
|
||||
|
||||
void MARKER_BASE::init()
|
||||
MARKER_BASE::MARKER_BASE( int aScalingFactor, RC_ITEM* aItem, TYPEMARKER aType ) :
|
||||
m_markerType( aType ),
|
||||
m_excluded( false ),
|
||||
m_rcItem( aItem ),
|
||||
m_scalingFactor( aScalingFactor )
|
||||
{
|
||||
m_MarkerType = MARKER_UNSPEC;
|
||||
m_Excluded = false;
|
||||
m_ErrorLevel = MARKER_SEVERITY_UNSPEC;
|
||||
const VECTOR2I* point_shape = GetShapePolygon();
|
||||
const VECTOR2I* point_shape = MarkerShapeCorners;
|
||||
wxPoint start( point_shape->x, point_shape->y );
|
||||
wxPoint end = start;
|
||||
|
||||
for( int ii = 1; ii < GetShapePolygonCornerCount(); ii++ )
|
||||
for( int ii = 1; ii < CORNERS_COUNT; ii++ )
|
||||
{
|
||||
++point_shape;
|
||||
start.x = std::min( start.x, point_shape->x);
|
||||
|
@ -80,80 +78,8 @@ void MARKER_BASE::init()
|
|||
end.y = std::max( end.y, point_shape->y);
|
||||
}
|
||||
|
||||
m_ShapeBoundingBox.SetOrigin(start);
|
||||
m_ShapeBoundingBox.SetEnd(end);
|
||||
}
|
||||
|
||||
|
||||
MARKER_BASE::MARKER_BASE( const MARKER_BASE& aMarker )
|
||||
{
|
||||
m_Pos = aMarker.m_Pos;
|
||||
m_ErrorLevel = aMarker.m_ErrorLevel;
|
||||
m_MarkerType = aMarker.m_MarkerType;
|
||||
m_ShapeBoundingBox = aMarker.m_ShapeBoundingBox;
|
||||
m_ScalingFactor = aMarker.m_ScalingFactor;
|
||||
}
|
||||
|
||||
|
||||
MARKER_BASE::MARKER_BASE( int aScalingFactor )
|
||||
{
|
||||
m_ScalingFactor = aScalingFactor;
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
MARKER_BASE::MARKER_BASE( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
|
||||
EDA_ITEM* aItem, const wxPoint& aPos,
|
||||
EDA_ITEM* bItem, const wxPoint& bPos, int aScalingFactor )
|
||||
{
|
||||
m_ScalingFactor = aScalingFactor;
|
||||
init();
|
||||
|
||||
SetData( aUnits, aErrorCode, aMarkerPos, aItem, aPos, bItem, bPos );
|
||||
}
|
||||
|
||||
|
||||
MARKER_BASE::MARKER_BASE( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
|
||||
EDA_ITEM* aItem,
|
||||
EDA_ITEM* bItem, int aScalingFactor )
|
||||
{
|
||||
m_ScalingFactor = aScalingFactor;
|
||||
init();
|
||||
|
||||
SetData( aUnits, aErrorCode, aMarkerPos, aItem, bItem );
|
||||
}
|
||||
|
||||
|
||||
MARKER_BASE::MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
|
||||
const wxString& aText, const wxPoint& aPos,
|
||||
const wxString& bText, const wxPoint& bPos, int aScalingFactor )
|
||||
{
|
||||
m_ScalingFactor = aScalingFactor;
|
||||
init();
|
||||
|
||||
SetData( aErrorCode, aMarkerPos, aText, aPos, bText, bPos );
|
||||
}
|
||||
|
||||
|
||||
MARKER_BASE::MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
|
||||
const wxString& aText,
|
||||
const wxString& bText, int aScalingFactor )
|
||||
{
|
||||
m_ScalingFactor = aScalingFactor;
|
||||
init();
|
||||
|
||||
SetData( aErrorCode, aMarkerPos, aText, bText );
|
||||
}
|
||||
|
||||
|
||||
MARKER_BASE::MARKER_BASE( int aErrorCode,
|
||||
const wxString& aText,
|
||||
const wxString& bText, int aScalingFactor )
|
||||
{
|
||||
m_ScalingFactor = aScalingFactor;
|
||||
init();
|
||||
|
||||
SetData( aErrorCode, wxPoint(), aText, bText );
|
||||
m_shapeBoundingBox.SetOrigin( start);
|
||||
m_shapeBoundingBox.SetEnd( end);
|
||||
}
|
||||
|
||||
|
||||
|
@ -167,8 +93,8 @@ void MARKER_BASE::SetData( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMar
|
|||
EDA_ITEM* bItem, const wxPoint& bPos )
|
||||
{
|
||||
m_Pos = aMarkerPos;
|
||||
m_drc.SetData( aUnits, aErrorCode, aItem, aPos, bItem, bPos );
|
||||
m_drc.SetParent( this );
|
||||
m_rcItem->SetData( aUnits, aErrorCode, aItem, aPos, bItem, bPos );
|
||||
m_rcItem->SetParent( this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -177,8 +103,8 @@ void MARKER_BASE::SetData( int aErrorCode, const wxPoint& aMarkerPos,
|
|||
const wxString& bText, const wxPoint& bPos )
|
||||
{
|
||||
m_Pos = aMarkerPos;
|
||||
m_drc.SetData( aErrorCode, aText, aPos, bText, bPos );
|
||||
m_drc.SetParent( this );
|
||||
m_rcItem->SetData( aErrorCode, aText, aPos, bText, bPos );
|
||||
m_rcItem->SetParent( this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -187,8 +113,8 @@ void MARKER_BASE::SetData( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMar
|
|||
EDA_ITEM* bItem )
|
||||
{
|
||||
m_Pos = aMarkerPos;
|
||||
m_drc.SetData( aUnits, aErrorCode, aItem, bItem );
|
||||
m_drc.SetParent( this );
|
||||
m_rcItem->SetData( aUnits, aErrorCode, aItem, bItem );
|
||||
m_rcItem->SetParent( this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -197,8 +123,8 @@ void MARKER_BASE::SetData( int aErrorCode, const wxPoint& aMarkerPos,
|
|||
const wxString& bText )
|
||||
{
|
||||
m_Pos = aMarkerPos;
|
||||
m_drc.SetData( aErrorCode, aText, bText );
|
||||
m_drc.SetParent( this );
|
||||
m_rcItem->SetData( aErrorCode, aText, bText );
|
||||
m_rcItem->SetParent( this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -207,8 +133,8 @@ void MARKER_BASE::SetData( int aErrorCode, const wxPoint& aMarkerPos,
|
|||
const wxString& bText, const KIID& bID )
|
||||
{
|
||||
m_Pos = aMarkerPos;
|
||||
m_drc.SetData( aErrorCode, aText, aID, bText, bID );
|
||||
m_drc.SetParent( this );
|
||||
m_rcItem->SetData( aErrorCode, aText, aID, bText, bID );
|
||||
m_rcItem->SetParent( this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -234,76 +160,36 @@ bool MARKER_BASE::HitTestMarker( const wxPoint& aHitPosition, int aAccuracy ) co
|
|||
|
||||
void MARKER_BASE::ShapeToPolygon( SHAPE_LINE_CHAIN& aPolygon) const
|
||||
{
|
||||
// Build the marker shape polygon in internal units:
|
||||
const int ccount = GetShapePolygonCornerCount();
|
||||
|
||||
for( int ii = 0; ii < ccount; ii++ )
|
||||
aPolygon.Append( GetShapePolygonCorner( ii ) * MarkerScale() );
|
||||
for( const VECTOR2I& corner : MarkerShapeCorners )
|
||||
aPolygon.Append( corner * MarkerScale() );
|
||||
|
||||
// Be sure aPolygon is seen as a closed polyline:
|
||||
aPolygon.SetClosed( true );
|
||||
}
|
||||
|
||||
|
||||
const VECTOR2I* MARKER_BASE::GetShapePolygon() const
|
||||
{
|
||||
return MarkerShapeCorners;
|
||||
}
|
||||
|
||||
|
||||
const VECTOR2I& MARKER_BASE::GetShapePolygonCorner( int aIdx ) const
|
||||
{
|
||||
return MarkerShapeCorners[aIdx];
|
||||
}
|
||||
|
||||
|
||||
int MARKER_BASE::GetShapePolygonCornerCount() const
|
||||
{
|
||||
return CORNERS_COUNT;
|
||||
}
|
||||
|
||||
|
||||
EDA_RECT MARKER_BASE::GetBoundingBoxMarker() const
|
||||
{
|
||||
wxSize size_iu = m_ShapeBoundingBox.GetSize();
|
||||
wxPoint position_iu = m_ShapeBoundingBox.GetPosition();
|
||||
size_iu.x *= m_ScalingFactor;
|
||||
size_iu.y *= m_ScalingFactor;
|
||||
position_iu.x *= m_ScalingFactor;
|
||||
position_iu.y *= m_ScalingFactor;
|
||||
wxSize size_iu = m_shapeBoundingBox.GetSize();
|
||||
wxPoint position_iu = m_shapeBoundingBox.GetPosition();
|
||||
size_iu.x *= m_scalingFactor;
|
||||
size_iu.y *= m_scalingFactor;
|
||||
position_iu.x *= m_scalingFactor;
|
||||
position_iu.y *= m_scalingFactor;
|
||||
position_iu += m_Pos;
|
||||
|
||||
return EDA_RECT( position_iu, size_iu );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MARKER_BASE::DisplayMarkerInfo( EDA_DRAW_FRAME* aFrame )
|
||||
{
|
||||
wxString msg = m_drc.ShowHtml( aFrame->GetUserUnits() );
|
||||
DIALOG_DISPLAY_HTML_TEXT_BASE infodisplay( (wxWindow*)aFrame, wxID_ANY, _( "Marker Info" ),
|
||||
wxGetMousePosition(), wxSize( 550, 140 ) );
|
||||
|
||||
infodisplay.m_htmlWindow->SetPage( msg );
|
||||
infodisplay.ShowModal();
|
||||
}
|
||||
|
||||
|
||||
void MARKER_BASE::PrintMarker( wxDC* aDC, const wxPoint& aOffset )
|
||||
{
|
||||
// Build the marker shape polygon in internal units:
|
||||
const int ccount = GetShapePolygonCornerCount();
|
||||
std::vector<wxPoint> shape;
|
||||
shape.reserve( ccount );
|
||||
shape.reserve( CORNERS_COUNT );
|
||||
|
||||
for( int ii = 0; ii < ccount; ii++ )
|
||||
{
|
||||
shape.emplace_back( GetShapePolygonCorner( ii ).x * MarkerScale(),
|
||||
GetShapePolygonCorner( ii ).y * MarkerScale() );
|
||||
}
|
||||
for( const VECTOR2I& corner : MarkerShapeCorners )
|
||||
shape.emplace_back( corner * MarkerScale() + m_Pos + aOffset );
|
||||
|
||||
for( int ii = 0; ii < ccount; ii++ )
|
||||
shape[ii] += m_Pos + aOffset;
|
||||
|
||||
GRClosedPoly( nullptr, aDC, ccount, &shape[0], true, 0, getColor(), getColor() );
|
||||
GRClosedPoly( nullptr, aDC, CORNERS_COUNT, &shape[0], true, 0, getColor(), getColor() );
|
||||
}
|
||||
|
|
|
@ -22,62 +22,90 @@
|
|||
*/
|
||||
|
||||
|
||||
#include <drc/drc_tree_model.h>
|
||||
#include <wx/wupdlock.h>
|
||||
#include <wx/dataview.h>
|
||||
#include <widgets/ui_common.h>
|
||||
#include <marker_base.h>
|
||||
#include <eda_base_frame.h>
|
||||
#include <rc_item.h>
|
||||
#include <base_units.h>
|
||||
|
||||
#define WX_DATAVIEW_WINDOW_PADDING 6
|
||||
|
||||
|
||||
BOARD_ITEM* DRC_TREE_MODEL::ToBoardItem( BOARD* aBoard, wxDataViewItem aItem )
|
||||
wxString RC_ITEM::ShowCoord( EDA_UNITS aUnits, const wxPoint& aPos )
|
||||
{
|
||||
BOARD_ITEM* board_item = nullptr;
|
||||
const DRC_TREE_NODE* node = DRC_TREE_MODEL::ToNode( aItem );
|
||||
|
||||
if( node )
|
||||
{
|
||||
const DRC_ITEM* drc_item = node->m_DrcItem;
|
||||
|
||||
switch( node->m_Type )
|
||||
{
|
||||
case DRC_TREE_NODE::MARKER:
|
||||
board_item = static_cast<MARKER_PCB*>( drc_item->GetParent() );
|
||||
break;
|
||||
case DRC_TREE_NODE::MAIN_ITEM:
|
||||
board_item = drc_item->GetMainItem( aBoard );
|
||||
break;
|
||||
case DRC_TREE_NODE::AUX_ITEM:
|
||||
board_item = drc_item->GetAuxiliaryItem( aBoard );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return board_item;
|
||||
return wxString::Format( "@(%s, %s)",
|
||||
MessageTextFromValue( aUnits, aPos.x ),
|
||||
MessageTextFromValue( aUnits, aPos.y ) );
|
||||
}
|
||||
|
||||
|
||||
DRC_TREE_MODEL::DRC_TREE_MODEL( PCB_BASE_FRAME* aParentFrame, wxDataViewCtrl* aView ) :
|
||||
m_parentFrame( aParentFrame ),
|
||||
m_view( aView ),
|
||||
m_severities( 0 ),
|
||||
m_drcItemsProvider( nullptr )
|
||||
wxString RC_ITEM::ShowReport( EDA_UNITS aUnits ) const
|
||||
{
|
||||
if( m_hasSecondItem )
|
||||
{
|
||||
return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n %s: %s\n" ),
|
||||
m_ErrorCode,
|
||||
GetErrorText(),
|
||||
ShowCoord( aUnits, m_MainPosition ),
|
||||
m_MainText,
|
||||
ShowCoord( aUnits, m_AuxPosition ),
|
||||
m_AuxText );
|
||||
}
|
||||
else
|
||||
{
|
||||
return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n" ),
|
||||
m_ErrorCode,
|
||||
GetErrorText(),
|
||||
ShowCoord( aUnits, m_MainPosition ),
|
||||
m_MainText );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
KIID RC_TREE_MODEL::ToUUID( wxDataViewItem aItem )
|
||||
{
|
||||
const RC_TREE_NODE* node = RC_TREE_MODEL::ToNode( aItem );
|
||||
|
||||
if( node )
|
||||
{
|
||||
const RC_ITEM* rc_item = node->m_RcItem;
|
||||
|
||||
switch( node->m_Type )
|
||||
{
|
||||
case RC_TREE_NODE::MARKER: return rc_item->GetParent()->GetUUID();
|
||||
case RC_TREE_NODE::MAIN_ITEM: return rc_item->GetMainItemID();
|
||||
case RC_TREE_NODE::AUX_ITEM: return rc_item->GetAuxItemID();
|
||||
}
|
||||
}
|
||||
|
||||
return niluuid;
|
||||
}
|
||||
|
||||
|
||||
RC_TREE_MODEL::RC_TREE_MODEL( EDA_BASE_FRAME* aParentFrame, wxDataViewCtrl* aView ) :
|
||||
m_editFrame( aParentFrame ),
|
||||
m_view( aView ),
|
||||
m_severities( 0 ),
|
||||
m_rcItemsProvider( nullptr )
|
||||
{
|
||||
m_view->GetMainWindow()->Connect( wxEVT_SIZE,
|
||||
wxSizeEventHandler( DRC_TREE_MODEL::onSizeView ),
|
||||
wxSizeEventHandler( RC_TREE_MODEL::onSizeView ),
|
||||
NULL, this );
|
||||
}
|
||||
|
||||
|
||||
DRC_TREE_MODEL::~DRC_TREE_MODEL()
|
||||
RC_TREE_MODEL::~RC_TREE_MODEL()
|
||||
{
|
||||
delete m_drcItemsProvider;
|
||||
delete m_rcItemsProvider;
|
||||
|
||||
for( DRC_TREE_NODE* topLevelNode : m_tree )
|
||||
for( RC_TREE_NODE* topLevelNode : m_tree )
|
||||
delete topLevelNode;
|
||||
}
|
||||
|
||||
|
||||
void DRC_TREE_MODEL::rebuildModel( DRC_ITEMS_PROVIDER* aProvider, int aSeverities )
|
||||
void RC_TREE_MODEL::rebuildModel( RC_ITEMS_PROVIDER* aProvider, int aSeverities )
|
||||
{
|
||||
wxWindowUpdateLocker updateLock( m_view );
|
||||
|
||||
|
@ -87,31 +115,31 @@ void DRC_TREE_MODEL::rebuildModel( DRC_ITEMS_PROVIDER* aProvider, int aSeveritie
|
|||
if( m_view )
|
||||
m_view->UnselectAll();
|
||||
|
||||
if( aProvider != m_drcItemsProvider )
|
||||
if( aProvider != m_rcItemsProvider )
|
||||
{
|
||||
delete m_drcItemsProvider;
|
||||
m_drcItemsProvider = aProvider;
|
||||
delete m_rcItemsProvider;
|
||||
m_rcItemsProvider = aProvider;
|
||||
}
|
||||
|
||||
if( aSeverities != m_severities )
|
||||
m_severities = aSeverities;
|
||||
|
||||
if( m_drcItemsProvider )
|
||||
m_drcItemsProvider->SetSeverities( m_severities );
|
||||
if( m_rcItemsProvider )
|
||||
m_rcItemsProvider->SetSeverities( m_severities );
|
||||
|
||||
m_tree.clear();
|
||||
|
||||
for( int i = 0; m_drcItemsProvider && i < m_drcItemsProvider->GetCount(); ++i )
|
||||
for( int i = 0; m_rcItemsProvider && i < m_rcItemsProvider->GetCount(); ++i )
|
||||
{
|
||||
DRC_ITEM* drcItem = m_drcItemsProvider->GetItem( i );
|
||||
RC_ITEM* drcItem = m_rcItemsProvider->GetItem( i );
|
||||
|
||||
m_tree.push_back( new DRC_TREE_NODE( nullptr, drcItem, DRC_TREE_NODE::MARKER ) );
|
||||
DRC_TREE_NODE* n = m_tree.back();
|
||||
m_tree.push_back( new RC_TREE_NODE( nullptr, drcItem, RC_TREE_NODE::MARKER ) );
|
||||
RC_TREE_NODE* n = m_tree.back();
|
||||
|
||||
n->m_Children.push_back( new DRC_TREE_NODE( n, drcItem, DRC_TREE_NODE::MAIN_ITEM ) );
|
||||
n->m_Children.push_back( new RC_TREE_NODE( n, drcItem, RC_TREE_NODE::MAIN_ITEM ) );
|
||||
|
||||
if( drcItem->GetAuxItemID() != niluuid )
|
||||
n->m_Children.push_back( new DRC_TREE_NODE( n, drcItem, DRC_TREE_NODE::AUX_ITEM ) );
|
||||
n->m_Children.push_back( new RC_TREE_NODE( n, drcItem, RC_TREE_NODE::AUX_ITEM ) );
|
||||
}
|
||||
|
||||
// Must be called after a significant change of items to force the
|
||||
|
@ -135,47 +163,47 @@ void DRC_TREE_MODEL::rebuildModel( DRC_ITEMS_PROVIDER* aProvider, int aSeveritie
|
|||
}
|
||||
|
||||
|
||||
void DRC_TREE_MODEL::SetProvider( DRC_ITEMS_PROVIDER* aProvider )
|
||||
void RC_TREE_MODEL::SetProvider( RC_ITEMS_PROVIDER* aProvider )
|
||||
{
|
||||
rebuildModel( aProvider, m_severities );
|
||||
}
|
||||
|
||||
|
||||
void DRC_TREE_MODEL::SetSeverities( int aSeverities )
|
||||
void RC_TREE_MODEL::SetSeverities( int aSeverities )
|
||||
{
|
||||
rebuildModel( m_drcItemsProvider, aSeverities );
|
||||
rebuildModel( m_rcItemsProvider, aSeverities );
|
||||
}
|
||||
|
||||
|
||||
void DRC_TREE_MODEL::ExpandAll()
|
||||
void RC_TREE_MODEL::ExpandAll()
|
||||
{
|
||||
for( DRC_TREE_NODE* topLevelNode : m_tree )
|
||||
for( RC_TREE_NODE* topLevelNode : m_tree )
|
||||
m_view->Expand( ToItem( topLevelNode ) );
|
||||
}
|
||||
|
||||
|
||||
bool DRC_TREE_MODEL::IsContainer( wxDataViewItem const& aItem ) const
|
||||
bool RC_TREE_MODEL::IsContainer( wxDataViewItem const& aItem ) const
|
||||
{
|
||||
if( ToNode( aItem ) == nullptr ) // must be tree root...
|
||||
return true;
|
||||
else
|
||||
return ToNode( aItem )->m_Type == DRC_TREE_NODE::MARKER;
|
||||
return ToNode( aItem )->m_Type == RC_TREE_NODE::MARKER;
|
||||
}
|
||||
|
||||
|
||||
wxDataViewItem DRC_TREE_MODEL::GetParent( wxDataViewItem const& aItem ) const
|
||||
wxDataViewItem RC_TREE_MODEL::GetParent( wxDataViewItem const& aItem ) const
|
||||
{
|
||||
return ToItem( ToNode( aItem)->m_Parent );
|
||||
}
|
||||
|
||||
|
||||
unsigned int DRC_TREE_MODEL::GetChildren( wxDataViewItem const& aItem,
|
||||
unsigned int RC_TREE_MODEL::GetChildren( wxDataViewItem const& aItem,
|
||||
wxDataViewItemArray& aChildren ) const
|
||||
{
|
||||
const DRC_TREE_NODE* node = ToNode( aItem );
|
||||
const std::vector<DRC_TREE_NODE*>& children = node ? node->m_Children : m_tree;
|
||||
const RC_TREE_NODE* node = ToNode( aItem );
|
||||
const std::vector<RC_TREE_NODE*>& children = node ? node->m_Children : m_tree;
|
||||
|
||||
for( const DRC_TREE_NODE* child: children )
|
||||
for( const RC_TREE_NODE* child: children )
|
||||
aChildren.push_back( ToItem( child ) );
|
||||
|
||||
return children.size();
|
||||
|
@ -185,34 +213,33 @@ unsigned int DRC_TREE_MODEL::GetChildren( wxDataViewItem const& aItem,
|
|||
/**
|
||||
* Called by the wxDataView to fetch an item's value.
|
||||
*/
|
||||
void DRC_TREE_MODEL::GetValue( wxVariant& aVariant,
|
||||
void RC_TREE_MODEL::GetValue( wxVariant& aVariant,
|
||||
wxDataViewItem const& aItem,
|
||||
unsigned int aCol ) const
|
||||
{
|
||||
const DRC_TREE_NODE* node = ToNode( aItem );
|
||||
const DRC_ITEM* drcItem = node->m_DrcItem;
|
||||
const RC_TREE_NODE* node = ToNode( aItem );
|
||||
const RC_ITEM* rcItem = node->m_RcItem;
|
||||
|
||||
switch( node->m_Type )
|
||||
{
|
||||
case DRC_TREE_NODE::MARKER:
|
||||
case RC_TREE_NODE::MARKER:
|
||||
{
|
||||
auto& bds = m_parentFrame->GetBoard()->GetDesignSettings();
|
||||
bool excluded = drcItem->GetParent() && drcItem->GetParent()->IsExcluded();
|
||||
bool error = bds.m_DRCSeverities[ drcItem->GetErrorCode() ] == RPT_SEVERITY_ERROR;
|
||||
bool excluded = rcItem->GetParent() && rcItem->GetParent()->IsExcluded();
|
||||
bool error = m_editFrame->GetSeverity( rcItem->GetErrorCode() ) == RPT_SEVERITY_ERROR;
|
||||
wxString prefix = wxString::Format( wxT( "%s%s" ),
|
||||
excluded ? _( "Excluded " ) : wxString( "" ),
|
||||
error ? _( "Error: " ) : _( "Warning: " ) );
|
||||
|
||||
aVariant = prefix + drcItem->GetErrorText();
|
||||
aVariant = prefix + rcItem->GetErrorText();
|
||||
}
|
||||
break;
|
||||
|
||||
case DRC_TREE_NODE::MAIN_ITEM:
|
||||
aVariant = drcItem->GetMainText();
|
||||
case RC_TREE_NODE::MAIN_ITEM:
|
||||
aVariant = rcItem->GetMainText();
|
||||
break;
|
||||
|
||||
case DRC_TREE_NODE::AUX_ITEM:
|
||||
aVariant = drcItem->GetAuxiliaryText();
|
||||
case RC_TREE_NODE::AUX_ITEM:
|
||||
aVariant = rcItem->GetAuxText();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -222,15 +249,15 @@ void DRC_TREE_MODEL::GetValue( wxVariant& aVariant,
|
|||
* Called by the wxDataView to fetch an item's formatting. Return true iff the
|
||||
* item has non-default attributes.
|
||||
*/
|
||||
bool DRC_TREE_MODEL::GetAttr( wxDataViewItem const& aItem,
|
||||
unsigned int aCol,
|
||||
wxDataViewItemAttr& aAttr ) const
|
||||
bool RC_TREE_MODEL::GetAttr( wxDataViewItem const& aItem,
|
||||
unsigned int aCol,
|
||||
wxDataViewItemAttr& aAttr ) const
|
||||
{
|
||||
const DRC_TREE_NODE* node = ToNode( aItem );
|
||||
const RC_TREE_NODE* node = ToNode( aItem );
|
||||
wxASSERT( node );
|
||||
|
||||
bool ret = false;
|
||||
bool heading = node->m_Type == DRC_TREE_NODE::MARKER;
|
||||
bool heading = node->m_Type == RC_TREE_NODE::MARKER;
|
||||
|
||||
if( heading )
|
||||
{
|
||||
|
@ -238,7 +265,7 @@ bool DRC_TREE_MODEL::GetAttr( wxDataViewItem const& aItem,
|
|||
ret = true;
|
||||
}
|
||||
|
||||
if( node->m_DrcItem->GetParent() && node->m_DrcItem->GetParent()->IsExcluded() )
|
||||
if( node->m_RcItem->GetParent() && node->m_RcItem->GetParent()->IsExcluded() )
|
||||
{
|
||||
wxColour textColour = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOXTEXT );
|
||||
|
||||
|
@ -255,14 +282,14 @@ bool DRC_TREE_MODEL::GetAttr( wxDataViewItem const& aItem,
|
|||
}
|
||||
|
||||
|
||||
void DRC_TREE_MODEL::ValueChanged( DRC_TREE_NODE* aNode )
|
||||
void RC_TREE_MODEL::ValueChanged( RC_TREE_NODE* aNode )
|
||||
{
|
||||
if( aNode->m_Type == DRC_TREE_NODE::MAIN_ITEM || aNode->m_Type == DRC_TREE_NODE::AUX_ITEM )
|
||||
if( aNode->m_Type == RC_TREE_NODE::MAIN_ITEM || aNode->m_Type == RC_TREE_NODE::AUX_ITEM )
|
||||
{
|
||||
ValueChanged( aNode->m_Parent );
|
||||
}
|
||||
|
||||
if( aNode->m_Type == DRC_TREE_NODE::MARKER )
|
||||
if( aNode->m_Type == RC_TREE_NODE::MARKER )
|
||||
{
|
||||
wxDataViewModel::ValueChanged( ToItem( aNode ), 0 );
|
||||
|
||||
|
@ -272,10 +299,10 @@ void DRC_TREE_MODEL::ValueChanged( DRC_TREE_NODE* aNode )
|
|||
}
|
||||
|
||||
|
||||
void DRC_TREE_MODEL::DeleteCurrentItem( bool aDeep )
|
||||
void RC_TREE_MODEL::DeleteCurrentItem( bool aDeep )
|
||||
{
|
||||
DRC_TREE_NODE* tree_node = ToNode( m_view->GetCurrentItem() );
|
||||
const DRC_ITEM* drc_item = tree_node ? tree_node->m_DrcItem : nullptr;
|
||||
RC_TREE_NODE* tree_node = ToNode( m_view->GetCurrentItem() );
|
||||
const RC_ITEM* drc_item = tree_node ? tree_node->m_RcItem : nullptr;
|
||||
|
||||
if( !drc_item )
|
||||
{
|
||||
|
@ -283,15 +310,15 @@ void DRC_TREE_MODEL::DeleteCurrentItem( bool aDeep )
|
|||
return;
|
||||
}
|
||||
|
||||
for( int i = 0; i < m_drcItemsProvider->GetCount(); ++i )
|
||||
for( int i = 0; i < m_rcItemsProvider->GetCount(); ++i )
|
||||
{
|
||||
if( m_drcItemsProvider->GetItem( i ) == drc_item )
|
||||
if( m_rcItemsProvider->GetItem( i ) == drc_item )
|
||||
{
|
||||
wxDataViewItem markerItem = ToItem( m_tree[i] );
|
||||
wxDataViewItemArray childItems;
|
||||
wxDataViewItem parentItem = ToItem( m_tree[i]->m_Parent );
|
||||
|
||||
for( DRC_TREE_NODE* child : m_tree[i]->m_Children )
|
||||
for( RC_TREE_NODE* child : m_tree[i]->m_Children )
|
||||
{
|
||||
childItems.push_back( ToItem( child ) );
|
||||
delete child;
|
||||
|
@ -304,18 +331,18 @@ void DRC_TREE_MODEL::DeleteCurrentItem( bool aDeep )
|
|||
m_tree.erase( m_tree.begin() + i );
|
||||
ItemDeleted( parentItem, markerItem );
|
||||
|
||||
m_drcItemsProvider->DeleteItem( i, aDeep );
|
||||
m_rcItemsProvider->DeleteItem( i, aDeep );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DRC_TREE_MODEL::DeleteAllItems()
|
||||
void RC_TREE_MODEL::DeleteAllItems()
|
||||
{
|
||||
if( m_drcItemsProvider )
|
||||
if( m_rcItemsProvider )
|
||||
{
|
||||
m_drcItemsProvider->DeleteAllItems();
|
||||
m_rcItemsProvider->DeleteAllItems();
|
||||
|
||||
m_tree.clear();
|
||||
Cleared();
|
||||
|
@ -323,7 +350,7 @@ void DRC_TREE_MODEL::DeleteAllItems()
|
|||
}
|
||||
|
||||
|
||||
void DRC_TREE_MODEL::onSizeView( wxSizeEvent& aEvent )
|
||||
void RC_TREE_MODEL::onSizeView( wxSizeEvent& aEvent )
|
||||
{
|
||||
int width = m_view->GetMainWindow()->GetRect().GetWidth() - WX_DATAVIEW_WINDOW_PADDING;
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
|
||||
* Copyright (C) 2018-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -22,68 +21,102 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef DRC_ITEM_H
|
||||
#define DRC_ITEM_H
|
||||
#ifndef RC_ITEM_H
|
||||
#define RC_ITEM_H
|
||||
|
||||
#include <wx/dataview.h>
|
||||
#include <macros.h>
|
||||
#include <base_struct.h>
|
||||
|
||||
class MARKER_BASE;
|
||||
class BOARD;
|
||||
class BOARD_ITEM;
|
||||
class EDA_BASE_FRAME;
|
||||
class RC_ITEM;
|
||||
|
||||
|
||||
/**
|
||||
* DRC_ITEM
|
||||
* Provide an abstract interface of a RC_ITEM* list manager.
|
||||
* The details of the actual list architecture are hidden from the caller. Any class that
|
||||
* implements this interface can then be used by a RC_TREE_MODEL class without it knowing
|
||||
* the actual architecture of the list.
|
||||
*/
|
||||
class RC_ITEMS_PROVIDER
|
||||
{
|
||||
public:
|
||||
virtual void SetSeverities( int aSeverities ) = 0;
|
||||
|
||||
virtual int GetCount( int aSeverity = -1 ) = 0;
|
||||
|
||||
/**
|
||||
* Function GetItem
|
||||
* retrieves a RC_ITEM by pointer. The actual item remains owned by the
|
||||
* list container.
|
||||
* @param aIndex The 0 based index into the list of the desired item.
|
||||
* @return const RC_ITEM* - the desired item or NULL if aIndex is out of range.
|
||||
*/
|
||||
virtual RC_ITEM* GetItem( int aIndex ) = 0;
|
||||
|
||||
/**
|
||||
* Function DeleteItems
|
||||
* removes and deletes desired item from the list.
|
||||
* @param aIndex The 0 based index into the list of the desired item which is to be deleted.
|
||||
* @param aDeep If true, the source item should be deleted as well as the filtered item.
|
||||
*/
|
||||
virtual void DeleteItem( int aIndex, bool aDeep ) = 0;
|
||||
|
||||
/**
|
||||
* Function DeleteAllItems
|
||||
* removes and deletes all the items in the list.
|
||||
*/
|
||||
virtual void DeleteAllItems() = 0;
|
||||
|
||||
virtual ~RC_ITEMS_PROVIDER() { }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* RC_ITEM
|
||||
* is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item.
|
||||
* There are holders for information on two EDA_ITEMs. Some errors involve only one item
|
||||
* (item with an incorrect param) so m_hasSecondItem is set to false in this case.
|
||||
*/
|
||||
class DRC_ITEM
|
||||
class RC_ITEM
|
||||
{
|
||||
protected:
|
||||
int m_ErrorCode; // the error code's numeric value
|
||||
wxString m_MainText; // text for the first EDA_ITEM
|
||||
wxString m_AuxText; // text for the second EDA_ITEM
|
||||
wxPoint m_MainPosition; // the location of the first EDA_ITEM
|
||||
wxPoint m_AuxPosition; // the location of the second EDA_ITEM
|
||||
bool m_hasPositions;
|
||||
bool m_hasSecondItem; // true when 2 items create a DRC/ERC error
|
||||
MARKER_BASE* m_parent; // The marker this item belongs to, if any
|
||||
KIID m_mainItemUuid;
|
||||
KIID m_auxItemUuid;
|
||||
int m_ErrorCode; // the error code's numeric value
|
||||
wxString m_MainText; // text for the first EDA_ITEM
|
||||
wxString m_AuxText; // text for the second EDA_ITEM
|
||||
wxPoint m_MainPosition; // the location of the first EDA_ITEM
|
||||
wxPoint m_AuxPosition; // the location of the second EDA_ITEM
|
||||
bool m_hasSecondItem; // true when 2 items create a DRC/ERC error
|
||||
MARKER_BASE* m_parent; // The marker this item belongs to, if any
|
||||
KIID m_mainItemUuid;
|
||||
KIID m_auxItemUuid;
|
||||
|
||||
public:
|
||||
|
||||
DRC_ITEM()
|
||||
RC_ITEM()
|
||||
{
|
||||
m_ErrorCode = 0;
|
||||
m_hasPositions = false;
|
||||
m_hasSecondItem = false;
|
||||
m_parent = nullptr;
|
||||
m_mainItemUuid = niluuid;
|
||||
m_auxItemUuid = niluuid;
|
||||
}
|
||||
|
||||
DRC_ITEM( EDA_UNITS aUnits, int aErrorCode,
|
||||
EDA_ITEM* aMainItem,
|
||||
EDA_ITEM* bAuxItem = nullptr )
|
||||
RC_ITEM( RC_ITEM* aItem )
|
||||
{
|
||||
SetData( aUnits, aErrorCode, aMainItem, bAuxItem );
|
||||
m_ErrorCode = aItem->m_ErrorCode;
|
||||
m_MainText = aItem->m_MainText;
|
||||
m_AuxText = aItem->m_AuxText;
|
||||
m_MainPosition = aItem->m_MainPosition;
|
||||
m_AuxPosition = aItem->m_AuxPosition;
|
||||
m_hasSecondItem = aItem->m_hasSecondItem;
|
||||
m_parent = aItem->m_parent;
|
||||
m_mainItemUuid = aItem->m_mainItemUuid;
|
||||
m_auxItemUuid = aItem->m_auxItemUuid;
|
||||
}
|
||||
|
||||
DRC_ITEM( EDA_UNITS aUnits, int aErrorCode,
|
||||
EDA_ITEM* aMainItem, const wxPoint& aMainPos,
|
||||
EDA_ITEM* bAuxItem = nullptr, const wxPoint& bAuxPos = wxPoint() )
|
||||
{
|
||||
SetData( aUnits, aErrorCode, aMainItem, aMainPos, bAuxItem, bAuxPos );
|
||||
}
|
||||
|
||||
DRC_ITEM( int aErrorCode, const wxString& aMainText )
|
||||
{
|
||||
SetData( aErrorCode, aMainText, wxPoint() );
|
||||
m_hasPositions = false;
|
||||
}
|
||||
virtual ~RC_ITEM() { }
|
||||
|
||||
/**
|
||||
* Function SetData
|
||||
|
@ -99,7 +132,6 @@ public:
|
|||
m_ErrorCode = aErrorCode;
|
||||
m_MainText = aMainItem->GetSelectMenuText( aUnits );
|
||||
m_AuxText = wxEmptyString;
|
||||
m_hasPositions = false;
|
||||
m_hasSecondItem = bAuxItem != nullptr;
|
||||
m_parent = nullptr;
|
||||
m_mainItemUuid = aMainItem->m_Uuid;
|
||||
|
@ -129,7 +161,6 @@ public:
|
|||
m_AuxText = wxEmptyString;
|
||||
m_MainPosition = aMainPos;
|
||||
m_AuxPosition = bAuxPos;
|
||||
m_hasPositions = true;
|
||||
m_hasSecondItem = bAuxItem != nullptr;
|
||||
m_parent = nullptr;
|
||||
m_mainItemUuid = aMainItem->m_Uuid;
|
||||
|
@ -155,7 +186,6 @@ public:
|
|||
m_ErrorCode = aErrorCode;
|
||||
m_MainText = aMainText;
|
||||
m_AuxText = bAuxText;
|
||||
m_hasPositions = false;
|
||||
m_hasSecondItem = !bAuxText.IsEmpty();
|
||||
m_parent = nullptr;
|
||||
m_mainItemUuid = niluuid;
|
||||
|
@ -180,7 +210,6 @@ public:
|
|||
m_AuxText = bAuxText;
|
||||
m_MainPosition = aMainPos;
|
||||
m_AuxPosition = bAuxPos;
|
||||
m_hasPositions = true;
|
||||
m_hasSecondItem = !bAuxText.IsEmpty();
|
||||
m_parent = nullptr;
|
||||
m_mainItemUuid = niluuid;
|
||||
|
@ -203,7 +232,6 @@ public:
|
|||
m_ErrorCode = aErrorCode;
|
||||
m_MainText = aMainText;
|
||||
m_AuxText = bAuxText;
|
||||
m_hasPositions = false;
|
||||
m_hasSecondItem = !bAuxText.IsEmpty() || bAuxID != niluuid;
|
||||
m_parent = nullptr;
|
||||
m_mainItemUuid = aMainID;
|
||||
|
@ -229,36 +257,18 @@ public:
|
|||
|
||||
bool HasSecondItem() const { return m_hasSecondItem; }
|
||||
|
||||
bool HasPositions() { return m_hasPositions; }
|
||||
|
||||
/**
|
||||
* Access to A and B texts
|
||||
*/
|
||||
wxString GetMainText() const { return m_MainText; }
|
||||
wxString GetAuxiliaryText() const { return m_AuxText; }
|
||||
|
||||
/**
|
||||
* Access to A and B items for BOARDs
|
||||
*/
|
||||
BOARD_ITEM* GetMainItem( BOARD* aBoard ) const;
|
||||
BOARD_ITEM* GetAuxiliaryItem( BOARD* aBoard ) const;
|
||||
wxString GetAuxText() const { return m_AuxText; }
|
||||
|
||||
KIID GetMainItemID() const { return m_mainItemUuid; }
|
||||
KIID GetAuxItemID() const { return m_auxItemUuid; }
|
||||
|
||||
/**
|
||||
* Function ShowHtml
|
||||
* translates this object into a fragment of HTML suitable for the wxHtmlListBox class.
|
||||
* @return wxString - the html text.
|
||||
*/
|
||||
wxString ShowHtml( EDA_UNITS aUnits ) const;
|
||||
|
||||
/**
|
||||
* Function ShowReport
|
||||
* translates this object into a text string suitable for saving to disk in a report.
|
||||
* @return wxString - the simple multi-line report text.
|
||||
*/
|
||||
wxString ShowReport( EDA_UNITS aUnits ) const;
|
||||
virtual wxString ShowReport( EDA_UNITS aUnits ) const;
|
||||
|
||||
int GetErrorCode() const { return m_ErrorCode; }
|
||||
|
||||
|
@ -266,13 +276,7 @@ public:
|
|||
* Function GetErrorText
|
||||
* returns the string form of a drc error code.
|
||||
*/
|
||||
wxString GetErrorText() const;
|
||||
|
||||
const wxString& GetTextA() const { return m_MainText; }
|
||||
const wxString& GetTextB() const { return m_AuxText; }
|
||||
|
||||
const wxPoint& GetPointA() const { return m_MainPosition; }
|
||||
const wxPoint& GetPointB() const { return m_AuxPosition; }
|
||||
virtual wxString GetErrorText() const = 0;
|
||||
|
||||
/**
|
||||
* Function ShowCoord
|
||||
|
@ -282,4 +286,115 @@ public:
|
|||
};
|
||||
|
||||
|
||||
#endif // DRC_ITEM_H
|
||||
class RC_TREE_NODE
|
||||
{
|
||||
public:
|
||||
enum NODE_TYPE { MARKER, MAIN_ITEM, AUX_ITEM };
|
||||
|
||||
RC_TREE_NODE( RC_TREE_NODE* aParent, RC_ITEM* aRcItem, NODE_TYPE aType ) :
|
||||
m_Type( aType ),
|
||||
m_RcItem( aRcItem ),
|
||||
m_Parent( aParent )
|
||||
{}
|
||||
|
||||
~RC_TREE_NODE()
|
||||
{
|
||||
for( RC_TREE_NODE* child : m_Children )
|
||||
delete child;
|
||||
}
|
||||
|
||||
NODE_TYPE m_Type;
|
||||
RC_ITEM* m_RcItem;
|
||||
|
||||
RC_TREE_NODE* m_Parent;
|
||||
std::vector<RC_TREE_NODE*> m_Children;
|
||||
};
|
||||
|
||||
|
||||
class RC_TREE_MODEL : public wxDataViewModel, wxEvtHandler
|
||||
{
|
||||
public:
|
||||
static wxDataViewItem ToItem( RC_TREE_NODE const* aNode )
|
||||
{
|
||||
return wxDataViewItem( const_cast<void*>( static_cast<void const*>( aNode ) ) );
|
||||
}
|
||||
|
||||
static RC_TREE_NODE* ToNode( wxDataViewItem aItem )
|
||||
{
|
||||
return static_cast<RC_TREE_NODE*>( aItem.GetID() );
|
||||
}
|
||||
|
||||
static KIID ToUUID( wxDataViewItem aItem );
|
||||
|
||||
|
||||
public:
|
||||
RC_TREE_MODEL( EDA_BASE_FRAME* aParentFrame, wxDataViewCtrl* aView );
|
||||
|
||||
~RC_TREE_MODEL();
|
||||
|
||||
void SetProvider( RC_ITEMS_PROVIDER* aProvider );
|
||||
void SetSeverities( int aSeverities );
|
||||
|
||||
int GetDRCItemCount() const { return m_tree.size(); }
|
||||
|
||||
void ExpandAll();
|
||||
|
||||
bool IsContainer( wxDataViewItem const& aItem ) const override;
|
||||
|
||||
wxDataViewItem GetParent( wxDataViewItem const& aItem ) const override;
|
||||
|
||||
unsigned int GetChildren( wxDataViewItem const& aItem,
|
||||
wxDataViewItemArray& aChildren ) const override;
|
||||
|
||||
// Simple, single-text-column model
|
||||
unsigned int GetColumnCount() const override { return 1; }
|
||||
wxString GetColumnType( unsigned int aCol ) const override { return "string"; }
|
||||
bool HasContainerColumns( wxDataViewItem const& aItem ) const override { return true; }
|
||||
|
||||
/**
|
||||
* Called by the wxDataView to fetch an item's value.
|
||||
*/
|
||||
void GetValue( wxVariant& aVariant,
|
||||
wxDataViewItem const& aItem,
|
||||
unsigned int aCol ) const override;
|
||||
|
||||
/**
|
||||
* Called by the wxDataView to edit an item's content.
|
||||
*/
|
||||
bool SetValue( wxVariant const& aVariant,
|
||||
wxDataViewItem const& aItem,
|
||||
unsigned int aCol ) override
|
||||
{
|
||||
// Editing not supported
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the wxDataView to fetch an item's formatting. Return true iff the
|
||||
* item has non-default attributes.
|
||||
*/
|
||||
bool GetAttr( wxDataViewItem const& aItem,
|
||||
unsigned int aCol,
|
||||
wxDataViewItemAttr& aAttr ) const override;
|
||||
|
||||
void ValueChanged( RC_TREE_NODE* aNode );
|
||||
|
||||
void DeleteCurrentItem( bool aDeep );
|
||||
void DeleteAllItems();
|
||||
|
||||
private:
|
||||
void rebuildModel( RC_ITEMS_PROVIDER* aProvider, int aSeverities );
|
||||
void onSizeView( wxSizeEvent& aEvent );
|
||||
|
||||
private:
|
||||
EDA_BASE_FRAME* m_editFrame;
|
||||
wxDataViewCtrl* m_view;
|
||||
int m_severities;
|
||||
RC_ITEMS_PROVIDER* m_rcItemsProvider; // I own this, but not its contents
|
||||
|
||||
std::vector<RC_TREE_NODE*> m_tree; // I own this
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // RC_ITEM_H
|
|
@ -154,11 +154,11 @@ set( EESCHEMA_SRCS
|
|||
component_references_lister.cpp
|
||||
connection_graph.cpp
|
||||
cross-probing.cpp
|
||||
drc_erc_item.cpp
|
||||
edit_label.cpp
|
||||
eeschema_config.cpp
|
||||
eeschema_settings.cpp
|
||||
erc.cpp
|
||||
erc_item.cpp
|
||||
fields_grid_table.cpp
|
||||
files-io.cpp
|
||||
generate_alias_info.cpp
|
||||
|
|
|
@ -34,11 +34,9 @@
|
|||
#include <sch_line.h>
|
||||
#include <sch_marker.h>
|
||||
#include <sch_pin.h>
|
||||
#include <sch_screen.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_sheet_path.h>
|
||||
#include <sch_text.h>
|
||||
#include <advanced_config.h>
|
||||
|
||||
#include <connection_graph.h>
|
||||
#include <widgets/ui_common.h>
|
||||
|
@ -58,7 +56,7 @@ bool CONNECTION_SUBGRAPH::ResolveDrivers( bool aCreateMarkers )
|
|||
// a higher-level sheet has a different name during the hierarchical
|
||||
// pass.
|
||||
|
||||
for( auto item : m_drivers )
|
||||
for( SCH_ITEM* item : m_drivers )
|
||||
{
|
||||
PRIORITY item_priority = GetDriverPriority( item );
|
||||
|
||||
|
@ -154,28 +152,13 @@ bool CONNECTION_SUBGRAPH::ResolveDrivers( bool aCreateMarkers )
|
|||
|
||||
if( !same )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "%s and %s are both attached to the same wires. "
|
||||
"%s was picked as the label to use for netlisting." ),
|
||||
candidates[0]->GetSelectMenuText( m_frame->GetUserUnits() ),
|
||||
second_item->GetSelectMenuText( m_frame->GetUserUnits() ),
|
||||
candidates[0]->Connection( m_sheet )->Name() );
|
||||
|
||||
wxASSERT( candidates[0] != second_item );
|
||||
|
||||
auto p0 = ( candidates[0]->Type() == SCH_PIN_T ) ?
|
||||
static_cast<SCH_PIN*>( candidates[0] )->GetTransformedPosition() :
|
||||
candidates[0]->GetPosition();
|
||||
|
||||
auto p1 = ( second_item->Type() == SCH_PIN_T ) ?
|
||||
static_cast<SCH_PIN*>( second_item )->GetTransformedPosition() :
|
||||
second_item->GetPosition();
|
||||
|
||||
auto marker = new SCH_MARKER();
|
||||
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_WARNING );
|
||||
marker->SetData( ERCE_DRIVER_CONFLICT, p0, msg, p1 );
|
||||
wxPoint pos = ( candidates[0]->Type() == SCH_PIN_T ) ?
|
||||
static_cast<SCH_PIN*>( candidates[0] )->GetTransformedPosition() :
|
||||
candidates[0]->GetPosition();
|
||||
|
||||
auto marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( m_frame->GetUserUnits(), ERCE_DRIVER_CONFLICT, pos,
|
||||
candidates[0], second_item );
|
||||
m_sheet.LastScreen()->Append( marker );
|
||||
|
||||
// If aCreateMarkers is true, then this is part of ERC check, so we
|
||||
|
@ -195,9 +178,9 @@ wxString CONNECTION_SUBGRAPH::GetNetName() const
|
|||
|
||||
if( !m_driver->Connection( m_sheet ) )
|
||||
{
|
||||
#ifdef CONNECTIVITY_DEBUG
|
||||
#ifdef CONNECTIVITY_DEBUG
|
||||
wxASSERT_MSG( false, "Tried to get the net name of an item with no connection" );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return "";
|
||||
}
|
||||
|
@ -210,14 +193,14 @@ std::vector<SCH_ITEM*> CONNECTION_SUBGRAPH::GetBusLabels() const
|
|||
{
|
||||
std::vector<SCH_ITEM*> labels;
|
||||
|
||||
for( auto item : m_drivers )
|
||||
for( SCH_ITEM* item : m_drivers )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
case SCH_LABEL_T:
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
{
|
||||
auto label_conn = item->Connection( m_sheet );
|
||||
SCH_CONNECTION* label_conn = item->Connection( m_sheet );
|
||||
|
||||
// Only consider bus vectors
|
||||
if( label_conn->Type() == CONNECTION_TYPE::BUS )
|
||||
|
@ -303,9 +286,9 @@ void CONNECTION_SUBGRAPH::UpdateItemConnections()
|
|||
if( !m_driver_connection )
|
||||
return;
|
||||
|
||||
for( auto item : m_items )
|
||||
for( SCH_ITEM* item : m_items )
|
||||
{
|
||||
auto item_conn = item->Connection( m_sheet );
|
||||
SCH_CONNECTION* item_conn = item->Connection( m_sheet );
|
||||
|
||||
if( !item_conn )
|
||||
item_conn = item->InitializeConnection( m_sheet );
|
||||
|
@ -432,7 +415,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet,
|
|||
{
|
||||
std::unordered_map< wxPoint, std::vector<SCH_ITEM*> > connection_map;
|
||||
|
||||
for( auto item : aItemList )
|
||||
for( SCH_ITEM* item : aItemList )
|
||||
{
|
||||
std::vector< wxPoint > points;
|
||||
item->GetConnectionPoints( points );
|
||||
|
@ -443,9 +426,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet,
|
|||
for( SCH_SHEET_PIN* pin : static_cast<SCH_SHEET*>( item )->GetPins() )
|
||||
{
|
||||
if( !pin->Connection( aSheet ) )
|
||||
{
|
||||
pin->InitializeConnection( aSheet );
|
||||
}
|
||||
|
||||
pin->ConnectedItems( aSheet ).clear();
|
||||
pin->Connection( aSheet )->Reset();
|
||||
|
@ -520,10 +501,8 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet,
|
|||
break;
|
||||
}
|
||||
|
||||
for( auto point : points )
|
||||
{
|
||||
for( const wxPoint& point : points )
|
||||
connection_map[ point ].push_back( item );
|
||||
}
|
||||
}
|
||||
|
||||
item->SetConnectivityDirty( false );
|
||||
|
@ -535,7 +514,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet,
|
|||
|
||||
for( auto primary_it = connection_vec.begin(); primary_it != connection_vec.end(); primary_it++ )
|
||||
{
|
||||
auto connected_item = *primary_it;
|
||||
SCH_ITEM* connected_item = *primary_it;
|
||||
|
||||
// Bus entries are special: they can have connection points in the
|
||||
// middle of a wire segment, because the junction algo doesn't split
|
||||
|
@ -551,8 +530,8 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet,
|
|||
// a segment at some point other than at one of the endpoints.
|
||||
if( connection_vec.size() == 1 )
|
||||
{
|
||||
auto screen = aSheet.LastScreen();
|
||||
auto bus = screen->GetBus( it.first );
|
||||
SCH_SCREEN* screen = aSheet.LastScreen();
|
||||
SCH_LINE* bus = screen->GetBus( it.first );
|
||||
|
||||
if( bus )
|
||||
{
|
||||
|
@ -567,8 +546,8 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet,
|
|||
{
|
||||
if( connection_vec.size() < 2 )
|
||||
{
|
||||
auto screen = aSheet.LastScreen();
|
||||
auto bus = screen->GetBus( it.first );
|
||||
SCH_SCREEN* screen = aSheet.LastScreen();
|
||||
SCH_LINE* bus = screen->GetBus( it.first );
|
||||
|
||||
if( bus )
|
||||
{
|
||||
|
@ -650,9 +629,7 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
|||
for( unsigned i = 0; i < all_sheets.size(); i++ )
|
||||
{
|
||||
for( const auto& alias : all_sheets[i].LastScreen()->GetBusAliases() )
|
||||
{
|
||||
m_bus_alias_cache[ alias->GetName() ] = alias;
|
||||
}
|
||||
}
|
||||
|
||||
// Build subgraphs from items (on a per-sheet basis)
|
||||
|
@ -748,7 +725,8 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
|||
std::vector<CONNECTION_SUBGRAPH*> dirty_graphs;
|
||||
|
||||
std::copy_if( m_subgraphs.begin(), m_subgraphs.end(), std::back_inserter( dirty_graphs ),
|
||||
[&] ( const CONNECTION_SUBGRAPH* candidate ) {
|
||||
[&] ( const CONNECTION_SUBGRAPH* candidate )
|
||||
{
|
||||
return candidate->m_dirty;
|
||||
} );
|
||||
|
||||
|
@ -856,8 +834,9 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
|||
// Now discard any non-driven subgraphs from further consideration
|
||||
|
||||
std::copy_if( m_subgraphs.begin(), m_subgraphs.end(), std::back_inserter( m_driver_subgraphs ),
|
||||
[&] ( const CONNECTION_SUBGRAPH* candidate ) -> bool {
|
||||
return candidate->m_driver;
|
||||
[&] ( const CONNECTION_SUBGRAPH* candidate ) -> bool
|
||||
{
|
||||
return candidate->m_driver;
|
||||
} );
|
||||
|
||||
// Check for subgraphs with the same net name but only weak drivers.
|
||||
|
@ -976,11 +955,8 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
|||
|
||||
std::unordered_set<CONNECTION_SUBGRAPH*> invalidated_subgraphs;
|
||||
|
||||
for( auto subgraph_it = m_driver_subgraphs.begin();
|
||||
subgraph_it != m_driver_subgraphs.end(); subgraph_it++ )
|
||||
for( CONNECTION_SUBGRAPH* subgraph : m_driver_subgraphs)
|
||||
{
|
||||
auto subgraph = *subgraph_it;
|
||||
|
||||
if( subgraph->m_absorbed )
|
||||
continue;
|
||||
|
||||
|
@ -991,12 +967,13 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
|||
// Test subgraphs with weak drivers for net name conflicts and fix them
|
||||
unsigned suffix = 1;
|
||||
|
||||
auto create_new_name = [&] ( SCH_CONNECTION* aConn, wxString aName ) -> wxString {
|
||||
wxString new_name = wxString::Format( "%s_%u", aName, suffix );
|
||||
aConn->SetSuffix( wxString::Format( "_%u", suffix ) );
|
||||
suffix++;
|
||||
return new_name;
|
||||
};
|
||||
auto create_new_name = [&] ( SCH_CONNECTION* aConn, wxString aName ) -> wxString
|
||||
{
|
||||
wxString new_name = wxString::Format( "%s_%u", aName, suffix );
|
||||
aConn->SetSuffix( wxString::Format( "_%u", suffix ) );
|
||||
suffix++;
|
||||
return new_name;
|
||||
};
|
||||
|
||||
if( !subgraph->m_strong_driver )
|
||||
{
|
||||
|
@ -1085,9 +1062,10 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
|||
m_sheet_to_subgraphs_map[ subgraph->m_sheet ].end(),
|
||||
std::back_inserter( candidate_subgraphs ),
|
||||
[&] ( const CONNECTION_SUBGRAPH* candidate )
|
||||
{ return ( !candidate->m_absorbed &&
|
||||
candidate->m_strong_driver &&
|
||||
candidate != subgraph );
|
||||
{
|
||||
return ( !candidate->m_absorbed &&
|
||||
candidate->m_strong_driver &&
|
||||
candidate != subgraph );
|
||||
} );
|
||||
|
||||
// This is a list of connections on the current subgraph to compare to the
|
||||
|
@ -1239,15 +1217,18 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
|||
|
||||
// Absorbed subgraphs should no longer be considered
|
||||
m_driver_subgraphs.erase( std::remove_if( m_driver_subgraphs.begin(), m_driver_subgraphs.end(),
|
||||
[&] ( const CONNECTION_SUBGRAPH* candidate ) -> bool {
|
||||
return candidate->m_absorbed;
|
||||
} ), m_driver_subgraphs.end() );
|
||||
[&] ( const CONNECTION_SUBGRAPH* candidate ) -> bool
|
||||
{
|
||||
return candidate->m_absorbed;
|
||||
} ),
|
||||
m_driver_subgraphs.end() );
|
||||
|
||||
// Store global subgraphs for later reference
|
||||
std::vector<CONNECTION_SUBGRAPH*> global_subgraphs;
|
||||
std::copy_if( m_driver_subgraphs.begin(), m_driver_subgraphs.end(),
|
||||
std::back_inserter( global_subgraphs ),
|
||||
[&] ( const CONNECTION_SUBGRAPH* candidate ) -> bool {
|
||||
[&] ( const CONNECTION_SUBGRAPH* candidate ) -> bool
|
||||
{
|
||||
return !candidate->m_local_driver;
|
||||
} );
|
||||
|
||||
|
@ -1378,7 +1359,7 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
|||
|
||||
m_net_code_to_subgraphs_map.clear();
|
||||
|
||||
for( auto subgraph : m_driver_subgraphs )
|
||||
for( CONNECTION_SUBGRAPH* subgraph : m_driver_subgraphs )
|
||||
{
|
||||
// Every driven subgraph should have been marked by now
|
||||
if( subgraph->m_dirty )
|
||||
|
@ -1398,7 +1379,8 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
|||
|
||||
// Clean up and deallocate stale subgraphs
|
||||
m_subgraphs.erase( std::remove_if( m_subgraphs.begin(), m_subgraphs.end(),
|
||||
[&]( const CONNECTION_SUBGRAPH* sg ) {
|
||||
[&]( const CONNECTION_SUBGRAPH* sg )
|
||||
{
|
||||
if( sg->m_absorbed )
|
||||
{
|
||||
delete sg;
|
||||
|
@ -1641,10 +1623,8 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph )
|
|||
|
||||
visit( aSubgraph );
|
||||
|
||||
for( unsigned i = 0; i < search_list.size(); i++ )
|
||||
for( CONNECTION_SUBGRAPH* child : search_list )
|
||||
{
|
||||
auto child = search_list[i];
|
||||
|
||||
visited.insert( child );
|
||||
|
||||
visit( child );
|
||||
|
@ -1707,8 +1687,8 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph )
|
|||
{
|
||||
for( CONNECTION_SUBGRAPH* subgraph : visited )
|
||||
{
|
||||
SCH_CONNECTION* member =
|
||||
matchBusMember( subgraph->m_driver_connection, stale_member );
|
||||
SCH_CONNECTION* member = matchBusMember( subgraph->m_driver_connection,
|
||||
stale_member );
|
||||
wxASSERT( member );
|
||||
|
||||
wxLogTrace( "CONN", "Updating %lu (%s) member %s to %s", subgraph->m_code,
|
||||
|
@ -1726,8 +1706,8 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph )
|
|||
}
|
||||
|
||||
|
||||
std::shared_ptr<SCH_CONNECTION> CONNECTION_GRAPH::getDefaultConnection(
|
||||
SCH_ITEM* aItem, SCH_SHEET_PATH aSheet )
|
||||
std::shared_ptr<SCH_CONNECTION> CONNECTION_GRAPH::getDefaultConnection( SCH_ITEM* aItem,
|
||||
SCH_SHEET_PATH aSheet )
|
||||
{
|
||||
auto c = std::shared_ptr<SCH_CONNECTION>( nullptr );
|
||||
|
||||
|
@ -1764,8 +1744,8 @@ std::shared_ptr<SCH_CONNECTION> CONNECTION_GRAPH::getDefaultConnection(
|
|||
}
|
||||
|
||||
|
||||
SCH_CONNECTION* CONNECTION_GRAPH::matchBusMember(
|
||||
SCH_CONNECTION* aBusConnection, SCH_CONNECTION* aSearch )
|
||||
SCH_CONNECTION* CONNECTION_GRAPH::matchBusMember( SCH_CONNECTION* aBusConnection,
|
||||
SCH_CONNECTION* aSearch )
|
||||
{
|
||||
wxASSERT( aBusConnection->IsBus() );
|
||||
|
||||
|
@ -1891,9 +1871,7 @@ std::vector<const CONNECTION_SUBGRAPH*> CONNECTION_GRAPH::GetBusesNeedingMigrati
|
|||
|
||||
int CONNECTION_GRAPH::RunERC()
|
||||
{
|
||||
int error_count = 0;
|
||||
ERC_SETTINGS& settings = m_frame->GetErcSettings();
|
||||
|
||||
int error_count = 0;
|
||||
|
||||
for( auto&& subgraph : m_subgraphs )
|
||||
{
|
||||
|
@ -1911,18 +1889,18 @@ int CONNECTION_GRAPH::RunERC()
|
|||
* format due to their TestDanglingEnds() implementation.
|
||||
*/
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_DRIVER_CONFLICT ) && !subgraph->ResolveDrivers() )
|
||||
if( g_ErcSettings->IsTestEnabled( ERCE_DRIVER_CONFLICT ) && !subgraph->ResolveDrivers() )
|
||||
error_count++;
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_BUS_TO_NET_CONFLICT )
|
||||
if( g_ErcSettings->IsTestEnabled( ERCE_BUS_TO_NET_CONFLICT )
|
||||
&& !ercCheckBusToNetConflicts( subgraph ) )
|
||||
error_count++;
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_BUS_ENTRY_CONFLICT )
|
||||
if( g_ErcSettings->IsTestEnabled( ERCE_BUS_ENTRY_CONFLICT )
|
||||
&& !ercCheckBusToBusEntryConflicts( subgraph ) )
|
||||
error_count++;
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_BUS_TO_BUS_CONFLICT )
|
||||
if( g_ErcSettings->IsTestEnabled( ERCE_BUS_TO_BUS_CONFLICT )
|
||||
&& !ercCheckBusToBusConflicts( subgraph ) )
|
||||
error_count++;
|
||||
|
||||
|
@ -1932,8 +1910,8 @@ int CONNECTION_GRAPH::RunERC()
|
|||
if( !ercCheckNoConnects( subgraph ) )
|
||||
error_count++;
|
||||
|
||||
if( ( settings.IsTestEnabled( ERCE_LABEL_NOT_CONNECTED )
|
||||
|| settings.IsTestEnabled( ERCE_GLOBLABEL ) ) && !ercCheckLabels( subgraph ) )
|
||||
if( ( g_ErcSettings->IsTestEnabled( ERCE_LABEL_NOT_CONNECTED )
|
||||
|| g_ErcSettings->IsTestEnabled( ERCE_GLOBLABEL ) ) && !ercCheckLabels( subgraph ) )
|
||||
error_count++;
|
||||
}
|
||||
|
||||
|
@ -1943,7 +1921,6 @@ int CONNECTION_GRAPH::RunERC()
|
|||
|
||||
bool CONNECTION_GRAPH::ercCheckBusToNetConflicts( const CONNECTION_SUBGRAPH* aSubgraph )
|
||||
{
|
||||
wxString msg;
|
||||
auto sheet = aSubgraph->m_sheet;
|
||||
auto screen = sheet.LastScreen();
|
||||
|
||||
|
@ -1985,18 +1962,9 @@ bool CONNECTION_GRAPH::ercCheckBusToNetConflicts( const CONNECTION_SUBGRAPH* aSu
|
|||
|
||||
if( net_item && bus_item )
|
||||
{
|
||||
msg.Printf( _( "%s and %s are graphically connected but cannot electrically connect "
|
||||
"because one is a bus and the other is a net." ),
|
||||
bus_item->GetSelectMenuText( m_frame->GetUserUnits() ),
|
||||
net_item->GetSelectMenuText( m_frame->GetUserUnits() ) );
|
||||
|
||||
auto marker = new SCH_MARKER();
|
||||
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_ERROR );
|
||||
marker->SetData( ERCE_BUS_TO_NET_CONFLICT,
|
||||
net_item->GetPosition(), msg,
|
||||
bus_item->GetPosition() );
|
||||
|
||||
auto marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( m_frame->GetUserUnits(), ERCE_BUS_TO_NET_CONFLICT,
|
||||
net_item->GetPosition(), net_item, bus_item );
|
||||
screen->Append( marker );
|
||||
|
||||
return false;
|
||||
|
@ -2061,17 +2029,9 @@ bool CONNECTION_GRAPH::ercCheckBusToBusConflicts( const CONNECTION_SUBGRAPH* aSu
|
|||
|
||||
if( !match )
|
||||
{
|
||||
msg.Printf( _( "%s and %s are graphically connected but do not share any bus members" ),
|
||||
label->GetSelectMenuText( m_frame->GetUserUnits() ),
|
||||
port->GetSelectMenuText( m_frame->GetUserUnits() ) );
|
||||
|
||||
auto marker = new SCH_MARKER();
|
||||
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_ERROR );
|
||||
marker->SetData( ERCE_BUS_TO_BUS_CONFLICT,
|
||||
label->GetPosition(), msg,
|
||||
port->GetPosition() );
|
||||
|
||||
auto marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( m_frame->GetUserUnits(), ERCE_BUS_TO_BUS_CONFLICT,
|
||||
label->GetPosition(), label, port );
|
||||
screen->Append( marker );
|
||||
|
||||
return false;
|
||||
|
@ -2084,7 +2044,6 @@ bool CONNECTION_GRAPH::ercCheckBusToBusConflicts( const CONNECTION_SUBGRAPH* aSu
|
|||
|
||||
bool CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts( const CONNECTION_SUBGRAPH* aSubgraph )
|
||||
{
|
||||
wxString msg;
|
||||
bool conflict = false;
|
||||
auto sheet = aSubgraph->m_sheet;
|
||||
auto screen = sheet.LastScreen();
|
||||
|
@ -2128,8 +2087,10 @@ bool CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts( const CONNECTION_SUBGRAPH
|
|||
if( member->Type() == CONNECTION_TYPE::BUS )
|
||||
{
|
||||
for( const auto& sub_member : member->Members() )
|
||||
{
|
||||
if( sub_member->Name( true ) == test_name )
|
||||
conflict = false;
|
||||
}
|
||||
}
|
||||
else if( member->Name( true ) == test_name )
|
||||
{
|
||||
|
@ -2141,26 +2102,15 @@ bool CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts( const CONNECTION_SUBGRAPH
|
|||
|
||||
// Don't report warnings if this bus member has been overridden by a higher priority power pin
|
||||
// or global label
|
||||
if( conflict
|
||||
&& CONNECTION_SUBGRAPH::GetDriverPriority( aSubgraph->m_driver )
|
||||
if( conflict && CONNECTION_SUBGRAPH::GetDriverPriority( aSubgraph->m_driver )
|
||||
>= CONNECTION_SUBGRAPH::PRIORITY::POWER_PIN )
|
||||
conflict = false;
|
||||
|
||||
if( conflict )
|
||||
{
|
||||
msg.Printf( _( "%s (%s) is connected to %s (%s) but is not a member of the bus" ),
|
||||
bus_entry->GetSelectMenuText( m_frame->GetUserUnits() ),
|
||||
bus_entry->Connection( sheet )->Name( true ),
|
||||
bus_wire->GetSelectMenuText( m_frame->GetUserUnits() ),
|
||||
bus_wire->Connection( sheet )->Name( true ) );
|
||||
|
||||
auto marker = new SCH_MARKER();
|
||||
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_WARNING );
|
||||
marker->SetData( ERCE_BUS_ENTRY_CONFLICT,
|
||||
bus_entry->GetPosition(), msg,
|
||||
bus_entry->GetPosition() );
|
||||
|
||||
auto marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( m_frame->GetUserUnits(), ERCE_BUS_ENTRY_CONFLICT,
|
||||
bus_entry->GetPosition(), bus_entry, bus_wire );
|
||||
screen->Append( marker );
|
||||
|
||||
return false;
|
||||
|
@ -2210,17 +2160,9 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
|
|||
|
||||
if( pin && has_invalid_items )
|
||||
{
|
||||
wxPoint pos = pin->GetTransformedPosition();
|
||||
|
||||
msg.Printf( _( "Pin %s of component %s has a no-connect marker but is connected" ),
|
||||
pin->GetName(),
|
||||
pin->GetParentComponent()->GetRef( &aSubgraph->m_sheet ) );
|
||||
|
||||
auto marker = new SCH_MARKER();
|
||||
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_WARNING );
|
||||
marker->SetData( ERCE_NOCONNECT_CONNECTED, pos, msg, pos );
|
||||
|
||||
auto marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( ERCE_NOCONNECT_CONNECTED, pin->GetTransformedPosition(),
|
||||
pin->GetDescription( &aSubgraph->m_sheet ), pin->m_Uuid );
|
||||
screen->Append( marker );
|
||||
|
||||
return false;
|
||||
|
@ -2228,15 +2170,9 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
|
|||
|
||||
if( !has_other_items )
|
||||
{
|
||||
wxPoint pos = aSubgraph->m_no_connect->GetPosition();
|
||||
|
||||
msg.Printf( _( "No-connect marker is not connected to anything" ) );
|
||||
|
||||
auto marker = new SCH_MARKER();
|
||||
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_WARNING );
|
||||
marker->SetData( ERCE_NOCONNECT_NOT_CONNECTED, pos, msg, pos );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( m_frame->GetUserUnits(), ERCE_NOCONNECT_NOT_CONNECTED,
|
||||
aSubgraph->m_no_connect->GetPosition(), aSubgraph->m_no_connect );
|
||||
screen->Append( marker );
|
||||
|
||||
return false;
|
||||
|
@ -2288,17 +2224,9 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
|
|||
|
||||
if( pin && !has_other_connections && pin->GetType() != ELECTRICAL_PINTYPE::PT_NC )
|
||||
{
|
||||
wxPoint pos = pin->GetTransformedPosition();
|
||||
|
||||
msg.Printf( _( "Pin %s of component %s is unconnected." ),
|
||||
pin->GetName(),
|
||||
pin->GetParentComponent()->GetRef( &aSubgraph->m_sheet ) );
|
||||
|
||||
auto marker = new SCH_MARKER();
|
||||
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_WARNING );
|
||||
marker->SetData( ERCE_PIN_NOT_CONNECTED, pos, msg, pos );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( ERCE_PIN_NOT_CONNECTED, pin->GetTransformedPosition(),
|
||||
pin->GetDescription( &aSubgraph->m_sheet ), pin->m_Uuid );
|
||||
screen->Append( marker );
|
||||
|
||||
return false;
|
||||
|
@ -2349,12 +2277,12 @@ bool CONNECTION_GRAPH::ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph )
|
|||
bool is_global = text->Type() == SCH_GLOBAL_LABEL_T;
|
||||
|
||||
// Global label check can be disabled independently
|
||||
if( !m_frame->GetErcSettings().IsTestEnabled( ERCE_GLOBLABEL ) && is_global )
|
||||
if( !g_ErcSettings->IsTestEnabled( ERCE_GLOBLABEL ) && is_global )
|
||||
return true;
|
||||
|
||||
wxString name = text->GetShownText();
|
||||
|
||||
if( is_global)
|
||||
if( is_global )
|
||||
{
|
||||
// This will be set to true if the global is connected to a pin above, but we
|
||||
// want to reset this to false so that globals get flagged if they only have a
|
||||
|
@ -2365,11 +2293,11 @@ bool CONNECTION_GRAPH::ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph )
|
|||
&& m_net_name_to_subgraphs_map.at( name ).size() > 1 )
|
||||
has_other_connections = true;
|
||||
}
|
||||
else if (text->Type() == SCH_HIER_LABEL_T)
|
||||
else if( text->Type() == SCH_HIER_LABEL_T )
|
||||
{
|
||||
// For a hier label, check if the parent pin is connected
|
||||
if (aSubgraph->m_hier_parent &&
|
||||
(aSubgraph->m_hier_parent->m_strong_driver ||
|
||||
if( aSubgraph->m_hier_parent &&
|
||||
( aSubgraph->m_hier_parent->m_strong_driver ||
|
||||
aSubgraph->m_hier_parent->m_drivers.size() > 1))
|
||||
{
|
||||
// For now, a simple check: if there is more than one driver, the parent is probably
|
||||
|
@ -2387,22 +2315,11 @@ bool CONNECTION_GRAPH::ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph )
|
|||
|
||||
if( !has_other_connections )
|
||||
{
|
||||
SCH_SCREEN* screen = aSubgraph->m_sheet.LastScreen();
|
||||
wxPoint pos = text->GetPosition();
|
||||
auto marker = new SCH_MARKER();
|
||||
|
||||
wxString msg;
|
||||
wxString prefix = is_global ? _( "Global label" ) : _( "Label" );
|
||||
ERCE_T type = is_global ? ERCE_GLOBLABEL : ERCE_LABEL_NOT_CONNECTED;
|
||||
|
||||
msg.Printf( _( "%s %s is not connected anywhere else in the schematic." ),
|
||||
prefix, GetChars( text->ShortenedShownText() ) );
|
||||
|
||||
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_WARNING );
|
||||
marker->SetData( type, pos, msg, pos );
|
||||
|
||||
screen->Append( marker );
|
||||
SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( m_frame->GetUserUnits(),
|
||||
is_global ? ERCE_GLOBLABEL : ERCE_LABEL_NOT_CONNECTED,
|
||||
text->GetPosition(), text );
|
||||
aSubgraph->m_sheet.LastScreen()->Append( marker );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,125 +0,0 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef DIALOG_ERC_LISTBOX_H
|
||||
#define DIALOG_ERC_LISTBOX_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <sch_draw_panel.h>
|
||||
#include <sch_marker.h>
|
||||
#include <wx/html/htmlwin.h>
|
||||
|
||||
/**
|
||||
* ERC_HTML_LISTFRAME
|
||||
* is used to display a DRC_ITEM_LIST.
|
||||
*/
|
||||
class ERC_HTML_LISTFRAME : public wxHtmlWindow
|
||||
{
|
||||
private:
|
||||
std::vector<SCH_MARKER*> m_MarkerListReferences; // The pointers to markers shown in list
|
||||
|
||||
public:
|
||||
ERC_HTML_LISTFRAME( wxWindow* parent, wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0 ) :
|
||||
wxHtmlWindow( parent, id, pos, size, style | wxHW_NO_SELECTION )
|
||||
{
|
||||
}
|
||||
|
||||
~ERC_HTML_LISTFRAME()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function AppendToList
|
||||
* @param aMarker is the SCH_MARKER* to add to the current list which will be
|
||||
* later displayed in the wxHtmlWindow
|
||||
*/
|
||||
void AppendToList( SCH_MARKER* aMarker )
|
||||
{
|
||||
m_MarkerListReferences.push_back( aMarker );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function DisplayList();
|
||||
* Build the Html marker list and show it
|
||||
*/
|
||||
void DisplayList( EDA_UNITS aUnits )
|
||||
{
|
||||
wxString htmlpage;
|
||||
wxColour bgcolor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
|
||||
wxColour fgcolor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
|
||||
// for each marker, build a link like:
|
||||
// <A HREF="marker_index">text to click</A>
|
||||
// The "text to click" is the error name (first line of the full error text).
|
||||
wxString marker_text;
|
||||
wxString href;
|
||||
|
||||
for( unsigned ii = 0; ii < m_MarkerListReferences.size(); ii++ )
|
||||
{
|
||||
href.Printf( wxT( "href='%d'" ), ii );
|
||||
marker_text = m_MarkerListReferences[ii]->GetReporter().ShowHtml( aUnits );
|
||||
marker_text.Replace( wxT( "href=''"), href );
|
||||
htmlpage += marker_text;
|
||||
}
|
||||
|
||||
SetPage( wxString::Format( wxT( "<html><body bgcolor='%s' text='%s'>%s</body></html>" ),
|
||||
bgcolor.GetAsString( wxC2S_HTML_SYNTAX ),
|
||||
fgcolor.GetAsString( wxC2S_HTML_SYNTAX ),
|
||||
htmlpage ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetItem
|
||||
* returns a requested DRC_ITEM* or NULL.
|
||||
*/
|
||||
const SCH_MARKER* GetItem( unsigned aIndex )
|
||||
{
|
||||
if( m_MarkerListReferences.size() > aIndex )
|
||||
{
|
||||
return m_MarkerListReferences[ aIndex ];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function ClearList
|
||||
* deletes all items shown in the list.
|
||||
* Does not erase markers in schematic
|
||||
*/
|
||||
void ClearList()
|
||||
{
|
||||
m_MarkerListReferences.clear();
|
||||
SetPage( wxEmptyString );
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// DIALOG_ERC_LISTBOX_H
|
|
@ -44,21 +44,32 @@
|
|||
#include <dialog_erc.h>
|
||||
#include <erc.h>
|
||||
#include <id.h>
|
||||
|
||||
#include <confirm.h>
|
||||
#include <wx/ffile.h>
|
||||
#include <erc_item.h>
|
||||
#include <eeschema_settings.h>
|
||||
|
||||
DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
|
||||
DIALOG_ERC_BASE( parent, ID_DIALOG_ERC ), // parent looks for this ID explicitly
|
||||
m_initialized( false )
|
||||
DIALOG_ERC_BASE( parent, ID_DIALOG_ERC ), // parent looks for this ID explicitly
|
||||
m_parent( parent ),
|
||||
m_severities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING )
|
||||
{
|
||||
m_parent = parent;
|
||||
m_lastMarkerFound = nullptr;
|
||||
EESCHEMA_SETTINGS* settings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
m_severities = settings->m_Appearance.erc_severities;
|
||||
|
||||
m_markerProvider = new SHEETLIST_ERC_ITEMS_PROVIDER();
|
||||
m_markerTreeModel = new RC_TREE_MODEL( parent, m_markerDataView );
|
||||
m_markerDataView->AssociateModel( m_markerTreeModel );
|
||||
|
||||
wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||
infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
|
||||
m_textMarkers->SetFont( infoFont );
|
||||
m_titleMessages->SetFont( infoFont );
|
||||
|
||||
Init();
|
||||
m_markerTreeModel->SetSeverities( m_severities );
|
||||
m_markerTreeModel->SetProvider( m_markerProvider );
|
||||
syncCheckboxes();
|
||||
updateDisplayedCounts();
|
||||
|
||||
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
|
||||
// that requires us to correct the button labels here.
|
||||
|
@ -73,35 +84,31 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_ERC::Init()
|
||||
DIALOG_ERC::~DIALOG_ERC()
|
||||
{
|
||||
m_initialized = false;
|
||||
EESCHEMA_SETTINGS* settings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
settings->m_Appearance.erc_severities = m_severities;
|
||||
|
||||
SCH_SCREENS screens;
|
||||
updateMarkerCounts( &screens );
|
||||
|
||||
DisplayERC_MarkersList();
|
||||
m_markerTreeModel->DecRef();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_ERC::updateMarkerCounts( SCH_SCREENS *screens )
|
||||
void DIALOG_ERC::updateDisplayedCounts()
|
||||
{
|
||||
int markers = screens->GetMarkerCount( MARKER_BASE::MARKER_ERC,
|
||||
MARKER_BASE::MARKER_SEVERITY_UNSPEC );
|
||||
int warnings = screens->GetMarkerCount( MARKER_BASE::MARKER_ERC,
|
||||
MARKER_BASE::MARKER_SEVERITY_WARNING );
|
||||
int errors = screens->GetMarkerCount( MARKER_BASE::MARKER_ERC,
|
||||
MARKER_BASE::MARKER_SEVERITY_ERROR );
|
||||
int numErrors = 0;
|
||||
int numWarnings = 0;
|
||||
int numExcluded = 0;
|
||||
|
||||
wxString num;
|
||||
num.Printf( wxT( "%d" ), markers );
|
||||
m_TotalErrCount->SetValue( num );
|
||||
if( m_markerProvider )
|
||||
{
|
||||
numErrors += m_markerProvider->GetCount( RPT_SEVERITY_ERROR );
|
||||
numWarnings += m_markerProvider->GetCount( RPT_SEVERITY_WARNING );
|
||||
numExcluded += m_markerProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
||||
}
|
||||
|
||||
num.Printf( wxT( "%d" ), errors );
|
||||
m_LastErrCount->SetValue( num );
|
||||
|
||||
num.Printf( wxT( "%d" ), warnings );
|
||||
m_LastWarningCount->SetValue( num );
|
||||
m_errorsBadge->SetBitmap( MakeBadge( RPT_SEVERITY_ERROR, numErrors, m_errorsBadge ) );
|
||||
m_warningsBadge->SetBitmap( MakeBadge( RPT_SEVERITY_WARNING, numWarnings, m_warningsBadge ) );
|
||||
m_exclusionsBadge->SetBitmap( MakeBadge( RPT_SEVERITY_EXCLUSION, numExcluded, m_exclusionsBadge ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,12 +116,9 @@ void DIALOG_ERC::updateMarkerCounts( SCH_SCREENS *screens )
|
|||
*/
|
||||
void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event )
|
||||
{
|
||||
SCH_SCREENS ScreenList;
|
||||
deleteAllMarkers();
|
||||
|
||||
ScreenList.DeleteAllMarkers( MARKER_BASE::MARKER_ERC );
|
||||
updateMarkerCounts( &ScreenList );
|
||||
|
||||
m_MarkersList->ClearList();
|
||||
updateDisplayedCounts();
|
||||
m_parent->GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
|
@ -122,20 +126,36 @@ void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event )
|
|||
// This is a modeless dialog so we have to handle these ourselves.
|
||||
void DIALOG_ERC::OnButtonCloseClick( wxCommandEvent& event )
|
||||
{
|
||||
m_parent->FocusOnItem( nullptr );
|
||||
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_ERC::OnCloseErcDialog( wxCloseEvent& event )
|
||||
{
|
||||
m_parent->FocusOnItem( nullptr );
|
||||
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_ERC::OnErcCmpClick( wxCommandEvent& event )
|
||||
static int RPT_SEVERITY_ALL = RPT_SEVERITY_WARNING | RPT_SEVERITY_ERROR | RPT_SEVERITY_EXCLUSION;
|
||||
|
||||
|
||||
void DIALOG_ERC::syncCheckboxes()
|
||||
{
|
||||
m_showAll->SetValue( m_severities == RPT_SEVERITY_ALL );
|
||||
m_showErrors->SetValue( m_severities & RPT_SEVERITY_ERROR );
|
||||
m_showWarnings->SetValue( m_severities & RPT_SEVERITY_WARNING );
|
||||
m_showExclusions->SetValue( m_severities & RPT_SEVERITY_EXCLUSION );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_ERC::OnRunERCClick( wxCommandEvent& event )
|
||||
{
|
||||
wxBusyCursor busy;
|
||||
m_MarkersList->ClearList();
|
||||
deleteAllMarkers();
|
||||
|
||||
m_MessagesList->Clear();
|
||||
wxSafeYield(); // m_MarkersList must be redraw
|
||||
|
@ -153,103 +173,6 @@ void DIALOG_ERC::RedrawDrawPanel()
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_ERC::OnLeftClickMarkersList( wxHtmlLinkEvent& event )
|
||||
{
|
||||
wxString link = event.GetLinkInfo().GetHref();
|
||||
|
||||
m_lastMarkerFound = nullptr;
|
||||
|
||||
long index;
|
||||
|
||||
if( !link.ToLong( &index ) )
|
||||
return;
|
||||
|
||||
const SCH_MARKER* marker = m_MarkersList->GetItem( index );
|
||||
|
||||
if( !marker )
|
||||
return;
|
||||
|
||||
// Search for the selected marker
|
||||
unsigned i;
|
||||
SCH_SHEET_LIST sheetList( g_RootSheet );
|
||||
bool found = false;
|
||||
|
||||
for( i = 0; i < sheetList.size(); i++ )
|
||||
{
|
||||
for( auto aItem : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
|
||||
{
|
||||
if( static_cast<const SCH_MARKER*>( aItem ) == marker )
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( found )
|
||||
break;
|
||||
}
|
||||
|
||||
if( !found ) // Error
|
||||
{
|
||||
wxMessageBox( _( "Marker not found" ) );
|
||||
|
||||
// The marker was deleted, so rebuild marker list
|
||||
DisplayERC_MarkersList();
|
||||
return;
|
||||
}
|
||||
|
||||
if( sheetList[i] != m_parent->GetCurrentSheet() )
|
||||
{
|
||||
m_parent->GetToolManager()->RunAction( ACTIONS::cancelInteractive, true );
|
||||
m_parent->GetToolManager()->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
m_parent->SetCurrentSheet( sheetList[i] );
|
||||
m_parent->DisplayCurrentSheet();
|
||||
sheetList[i].LastScreen()->SetZoom( m_parent->GetScreen()->GetZoom() );
|
||||
m_parent->RedrawScreen( (wxPoint) m_parent->GetScreen()->m_ScrollCenter, false );
|
||||
}
|
||||
|
||||
m_lastMarkerFound = marker;
|
||||
m_parent->FocusOnLocation( marker->m_Pos );
|
||||
RedrawDrawPanel();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_ERC::OnLeftDblClickMarkersList( wxMouseEvent& event )
|
||||
{
|
||||
// Remember: OnLeftClickMarkersList was called just before and therefore m_lastMarkerFound
|
||||
// was initialized (NULL if not found).
|
||||
if( m_lastMarkerFound )
|
||||
{
|
||||
m_parent->FocusOnLocation( m_lastMarkerFound->m_Pos );
|
||||
RedrawDrawPanel();
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DIALOG_ERC::DisplayERC_MarkersList()
|
||||
{
|
||||
SCH_SHEET_LIST sheetList( g_RootSheet);
|
||||
m_MarkersList->ClearList();
|
||||
|
||||
for( unsigned i = 0; i < sheetList.size(); i++ )
|
||||
{
|
||||
for( auto aItem : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
|
||||
{
|
||||
SCH_MARKER* marker = static_cast<SCH_MARKER*>( aItem );
|
||||
|
||||
if( marker->GetMarkerType() == MARKER_BASE::MARKER_ERC )
|
||||
m_MarkersList->AppendToList( marker );
|
||||
}
|
||||
}
|
||||
|
||||
m_MarkersList->DisplayList( GetUserUnits() );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_ERC::TestErc( REPORTER& aReporter )
|
||||
{
|
||||
wxFileName fn;
|
||||
|
@ -268,21 +191,31 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter )
|
|||
|
||||
SCH_SCREENS screens;
|
||||
|
||||
// Erase all previous DRC markers.
|
||||
screens.DeleteAllMarkers( MARKER_BASE::MARKER_ERC );
|
||||
|
||||
// Test duplicate sheet names inside a given sheet. While one can have multiple references
|
||||
// to the same file, each must have a unique name.
|
||||
TestDuplicateSheetNames( true );
|
||||
if( g_ErcSettings->IsTestEnabled( ERCE_DUPLICATE_SHEET_NAME ) )
|
||||
{
|
||||
aReporter.ReportTail( _( "Checking sheet names...\n" ), RPT_SEVERITY_INFO );
|
||||
TestDuplicateSheetNames( true );
|
||||
}
|
||||
|
||||
TestConflictingBusAliases();
|
||||
if( g_ErcSettings->IsTestEnabled( ERCE_BUS_ALIAS_CONFLICT ) )
|
||||
{
|
||||
aReporter.ReportTail( _( "Checking bus conflicts...\n" ), RPT_SEVERITY_INFO );
|
||||
TestConflictingBusAliases();
|
||||
}
|
||||
|
||||
// The connection graph has a whole set of ERC checks it can run
|
||||
aReporter.ReportTail( _( "Checking conflicts...\n" ) );
|
||||
m_parent->RecalculateConnections( NO_CLEANUP );
|
||||
g_ConnectionGraph->RunERC();
|
||||
|
||||
// Test is all units of each multiunit component have the same footprint assigned.
|
||||
TestMultiunitFootprints( sheets );
|
||||
if( g_ErcSettings->IsTestEnabled( ERCE_DIFFERENT_UNIT_FP ) )
|
||||
{
|
||||
aReporter.ReportTail( _( "Checking footprints...\n" ), RPT_SEVERITY_INFO );
|
||||
TestMultiunitFootprints( sheets );
|
||||
}
|
||||
|
||||
std::unique_ptr<NETLIST_OBJECT_LIST> objectsConnectedList( m_parent->BuildNetListBase() );
|
||||
|
||||
|
@ -291,7 +224,7 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter )
|
|||
|
||||
unsigned lastItemIdx = 0;
|
||||
unsigned nextItemIdx = 0;
|
||||
int MinConn = NOC;
|
||||
int MinConn = NOC;
|
||||
|
||||
// Check that a pin appears in only one net. This check is necessary because multi-unit
|
||||
// components that have shared pins could be wired to different nets.
|
||||
|
@ -302,6 +235,7 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter )
|
|||
// nextItem to the current item (exclusive) needs to be checked against the current item.
|
||||
// The lastItem variable is used as a helper to pass the last item's number from one loop
|
||||
// iteration to the next, which simplifies the initial pass.
|
||||
aReporter.ReportTail( _( "Checking connections...\n" ), RPT_SEVERITY_INFO );
|
||||
for( unsigned itemIdx = 0; itemIdx < objectsConnectedList->size(); itemIdx++ )
|
||||
{
|
||||
auto item = objectsConnectedList->GetItem( itemIdx );
|
||||
|
@ -336,10 +270,11 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter )
|
|||
case NETLIST_ITEM::PIN:
|
||||
{
|
||||
// Check if this pin has appeared before on a different net
|
||||
if( item->m_Link )
|
||||
if( item->m_Link && g_ErcSettings->IsTestEnabled( ERCE_DIFFERENT_UNIT_NET ) )
|
||||
{
|
||||
auto ref = item->GetComponentParent()->GetRef( &item->m_SheetPath );
|
||||
wxString ref = item->GetComponentParent()->GetRef( &item->m_SheetPath );
|
||||
wxString pin_name = ref + "_" + item->m_PinNum;
|
||||
wxString msg;
|
||||
|
||||
if( pin_to_net_map.count( pin_name ) == 0 )
|
||||
{
|
||||
|
@ -347,18 +282,14 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter )
|
|||
}
|
||||
else if( pin_to_net_map[pin_name] != item->GetNetName() )
|
||||
{
|
||||
SCH_MARKER* marker = new SCH_MARKER();
|
||||
|
||||
marker->SetData( ERCE_DIFFERENT_UNIT_NET, item->m_Start,
|
||||
wxString::Format( _( "Pin %s on %s is connected to both %s and %s" ),
|
||||
item->m_PinNum,
|
||||
ref,
|
||||
pin_to_net_map[pin_name],
|
||||
item->GetNetName() ),
|
||||
item->m_Start );
|
||||
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_ERROR );
|
||||
msg.Printf( _( "Pin %s on %s is connected to both %s and %s" ),
|
||||
item->m_PinNum,
|
||||
ref,
|
||||
pin_to_net_map[pin_name],
|
||||
item->GetNetName() );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( ERCE_DIFFERENT_UNIT_NET, item->m_Start, msg, item->m_Start );
|
||||
item->m_SheetPath.LastScreen()->Append( marker );
|
||||
}
|
||||
}
|
||||
|
@ -376,17 +307,17 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter )
|
|||
|
||||
// Test similar labels (i;e. labels which are identical when
|
||||
// using case insensitive comparisons)
|
||||
if( m_parent->GetErcSettings().IsTestEnabled( ERCE_SIMILAR_GLBL_LABELS )
|
||||
|| m_parent->GetErcSettings().IsTestEnabled( ERCE_SIMILAR_LABELS ) )
|
||||
if( g_ErcSettings->IsTestEnabled( ERCE_SIMILAR_LABELS ) )
|
||||
{
|
||||
aReporter.ReportTail( _( "Checking labels...\n" ), RPT_SEVERITY_INFO );
|
||||
objectsConnectedList->TestforSimilarLabels();
|
||||
}
|
||||
|
||||
// Displays global results:
|
||||
updateMarkerCounts( &screens );
|
||||
|
||||
// Display diags:
|
||||
DisplayERC_MarkersList();
|
||||
m_markerTreeModel->SetProvider( m_markerProvider );
|
||||
|
||||
// Displays global results:
|
||||
updateDisplayedCounts();
|
||||
|
||||
// Display new markers from the current screen:
|
||||
KIGFX::VIEW* view = m_parent->GetCanvas()->GetView();
|
||||
|
@ -401,6 +332,289 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_ERC::OnERCItemSelected( wxDataViewEvent& aEvent )
|
||||
{
|
||||
const KIID& itemID = RC_TREE_MODEL::ToUUID( aEvent.GetItem() );
|
||||
SCH_SHEET_LIST sheetList( g_RootSheet );
|
||||
SCH_SHEET_PATH sheet;
|
||||
SCH_ITEM* item = sheetList.GetItem( itemID, &sheet );
|
||||
|
||||
if( item )
|
||||
{
|
||||
WINDOW_THAWER thawer( m_parent );
|
||||
|
||||
if( sheet != m_parent->GetCurrentSheet() )
|
||||
{
|
||||
m_parent->GetToolManager()->RunAction( ACTIONS::cancelInteractive, true );
|
||||
m_parent->GetToolManager()->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
m_parent->SetCurrentSheet( sheet );
|
||||
m_parent->DisplayCurrentSheet();
|
||||
sheet.LastScreen()->SetZoom( m_parent->GetScreen()->GetZoom() );
|
||||
m_parent->RedrawScreen( (wxPoint) m_parent->GetScreen()->m_ScrollCenter, false );
|
||||
}
|
||||
|
||||
m_parent->FocusOnItem( item );
|
||||
RedrawDrawPanel();
|
||||
}
|
||||
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_ERC::OnERCItemDClick( wxDataViewEvent& aEvent )
|
||||
{
|
||||
if( aEvent.GetItem().IsOk() )
|
||||
{
|
||||
// turn control over to m_parent, hide this DIALOG_ERC window,
|
||||
// no destruction so we can preserve listbox cursor
|
||||
if( !IsModal() )
|
||||
Show( false );
|
||||
}
|
||||
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_ERC::OnERCItemRClick( wxDataViewEvent& aEvent )
|
||||
{
|
||||
RC_TREE_NODE* node = RC_TREE_MODEL::ToNode( aEvent.GetItem() );
|
||||
|
||||
if( !node )
|
||||
return;
|
||||
|
||||
RC_ITEM* rcItem = node->m_RcItem;
|
||||
wxString listName;
|
||||
wxMenu menu;
|
||||
|
||||
switch( GetSeverity( rcItem->GetErrorCode() ) )
|
||||
{
|
||||
case RPT_SEVERITY_ERROR: listName = _( "errors" ); break;
|
||||
case RPT_SEVERITY_WARNING: listName = _( "warnings" ); break;
|
||||
default: listName = _( "appropriate" ); break;
|
||||
}
|
||||
|
||||
if( rcItem->GetParent()->IsExcluded() )
|
||||
{
|
||||
menu.Append( 1, _( "Remove exclusion for this violation" ),
|
||||
wxString::Format( _( "It will be placed back in the %s list" ), listName ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
menu.Append( 2, _( "Exclude this violation" ),
|
||||
wxString::Format( _( "It will be excluded from the %s list" ), listName ) );
|
||||
}
|
||||
|
||||
menu.AppendSeparator();
|
||||
|
||||
if( GetSeverity( rcItem->GetErrorCode() ) == RPT_SEVERITY_WARNING )
|
||||
{
|
||||
menu.Append( 3, wxString::Format( _( "Change severity to Error for all '%s' violations" ),
|
||||
rcItem->GetErrorText(),
|
||||
_( "Violation severities can also be edited in the Board Setup... dialog" ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
menu.Append( 4, wxString::Format( _( "Change severity to Warning for all '%s' violations" ),
|
||||
rcItem->GetErrorText(),
|
||||
_( "Violation severities can also be edited in the Board Setup... dialog" ) ) );
|
||||
}
|
||||
|
||||
menu.Append( 5, wxString::Format( _( "Ignore all '%s' violations" ),
|
||||
rcItem->GetErrorText() ),
|
||||
_( "Violations will not be checked or reported" ) );
|
||||
|
||||
menu.AppendSeparator();
|
||||
|
||||
menu.Append( 6, _( "Edit violation severities..." ), _( "Open the Schematic Setup... dialog" ) );
|
||||
|
||||
switch( GetPopupMenuSelectionFromUser( menu ) )
|
||||
{
|
||||
case 1:
|
||||
node->m_RcItem->GetParent()->SetExcluded( false );
|
||||
|
||||
// Update view
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
|
||||
updateDisplayedCounts();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
node->m_RcItem->GetParent()->SetExcluded( true );
|
||||
|
||||
// Update view
|
||||
if( m_severities & RPT_SEVERITY_EXCLUSION )
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
|
||||
else
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->DeleteCurrentItem( false );
|
||||
|
||||
updateDisplayedCounts();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
SetSeverity( rcItem->GetErrorCode(), RPT_SEVERITY_ERROR );
|
||||
|
||||
// Rebuild model and view
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markerProvider );
|
||||
updateDisplayedCounts();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
SetSeverity( rcItem->GetErrorCode(), RPT_SEVERITY_WARNING );
|
||||
|
||||
// Rebuild model and view
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markerProvider );
|
||||
updateDisplayedCounts();
|
||||
break;
|
||||
|
||||
case 5:
|
||||
{
|
||||
SetSeverity( rcItem->GetErrorCode(), RPT_SEVERITY_IGNORE );
|
||||
|
||||
SCH_SCREENS ScreenList;
|
||||
ScreenList.DeleteMarkers( MARKER_BASE::MARKER_ERC, rcItem->GetErrorCode() );
|
||||
|
||||
// Rebuild model and view
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markerProvider );
|
||||
updateDisplayedCounts();
|
||||
}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
m_parent->DoShowSchematicSetupDialog( _( "Violation Severity" ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_ERC::OnSeverity( wxCommandEvent& aEvent )
|
||||
{
|
||||
int flag = 0;
|
||||
|
||||
if( aEvent.GetEventObject() == m_showAll )
|
||||
flag = RPT_SEVERITY_ALL;
|
||||
else if( aEvent.GetEventObject() == m_showErrors )
|
||||
flag = RPT_SEVERITY_ERROR;
|
||||
else if( aEvent.GetEventObject() == m_showWarnings )
|
||||
flag = RPT_SEVERITY_WARNING;
|
||||
else if( aEvent.GetEventObject() == m_showExclusions )
|
||||
flag = RPT_SEVERITY_EXCLUSION;
|
||||
|
||||
if( aEvent.IsChecked() )
|
||||
m_severities |= flag;
|
||||
else if( aEvent.GetEventObject() == m_showAll )
|
||||
m_severities = RPT_SEVERITY_ERROR;
|
||||
else
|
||||
m_severities &= ~flag;
|
||||
|
||||
syncCheckboxes();
|
||||
|
||||
// Set the provider's severity levels through the TreeModel so that the old tree
|
||||
// can be torn down before the severity changes.
|
||||
//
|
||||
// It's not clear this is required, but we've had a lot of issues with wxDataView
|
||||
// being cranky on various platforms.
|
||||
|
||||
m_markerTreeModel->SetSeverities( m_severities );
|
||||
|
||||
updateDisplayedCounts();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_ERC::deleteAllMarkers()
|
||||
{
|
||||
// Clear current selection list to avoid selection of deleted items
|
||||
m_parent->GetToolManager()->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
m_markerTreeModel->DeleteAllItems();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_ERC::OnSaveReport( wxCommandEvent& aEvent )
|
||||
{
|
||||
wxFileName fn( "./ERC." + ReportFileExtension );
|
||||
|
||||
wxFileDialog dlg( this, _( "Save Report to File" ), fn.GetPath(), fn.GetFullName(),
|
||||
ReportFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = dlg.GetPath();
|
||||
|
||||
if( fn.GetExt().IsEmpty() )
|
||||
fn.SetExt( ReportFileExtension );
|
||||
|
||||
if( !fn.IsAbsolute() )
|
||||
{
|
||||
wxString prj_path = Prj().GetProjectPath();
|
||||
fn.MakeAbsolute( prj_path );
|
||||
}
|
||||
|
||||
if( writeReport( fn.GetFullPath() ) )
|
||||
{
|
||||
m_MessagesList->AppendText( wxString::Format( _( "Report file '%s' created\n" ),
|
||||
fn.GetFullPath() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayError( this, wxString::Format( _( "Unable to create report file '%s'" ),
|
||||
fn.GetFullPath() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_ERC::writeReport( const wxString& aFullFileName )
|
||||
{
|
||||
wxFFile file( aFullFileName, wxT( "wt" ) );
|
||||
|
||||
if( !file.IsOpened() )
|
||||
return false;
|
||||
|
||||
wxString msg = wxString::Format( _( "ERC report (%s, Encoding UTF8)\n" ), DateAndTime() );
|
||||
|
||||
int err_count = 0;
|
||||
int warn_count = 0;
|
||||
int total_count = 0;
|
||||
SCH_SHEET_LIST sheetList( g_RootSheet );
|
||||
|
||||
for( unsigned i = 0; i < sheetList.size(); i++ )
|
||||
{
|
||||
msg << wxString::Format( _( "\n***** Sheet %s\n" ), sheetList[i].PathHumanReadable() );
|
||||
|
||||
for( auto aItem : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
|
||||
{
|
||||
auto marker = static_cast<const SCH_MARKER*>( aItem );
|
||||
|
||||
if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
|
||||
continue;
|
||||
|
||||
total_count++;
|
||||
|
||||
switch( g_ErcSettings->m_Severities[ marker->GetRCItem()->GetErrorCode() ] )
|
||||
{
|
||||
case RPT_SEVERITY_ERROR: err_count++; break;
|
||||
case RPT_SEVERITY_WARNING: warn_count++; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
msg << marker->GetRCItem()->ShowReport( GetUserUnits() );
|
||||
}
|
||||
}
|
||||
|
||||
msg << wxString::Format( _( "\n ** ERC messages: %d Errors %d Warnings %d\n" ),
|
||||
total_count, err_count, warn_count );
|
||||
|
||||
// Currently: write report using UTF8 (as usual in Kicad).
|
||||
// TODO: see if we can use the current encoding page (mainly for Windows users),
|
||||
// Or other format (HTML?)
|
||||
file.Write( msg );
|
||||
|
||||
// wxFFile dtor will close the file.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
wxDialog* InvokeDialogERC( SCH_EDIT_FRAME* aCaller )
|
||||
{
|
||||
// This is a modeless dialog, so new it rather than instantiating on stack.
|
||||
|
|
|
@ -31,40 +31,46 @@
|
|||
|
||||
#include <dialog_erc_base.h>
|
||||
#include <erc_settings.h>
|
||||
#include "dialog_erc_listbox.h"
|
||||
|
||||
// DIALOG_ERC class declaration
|
||||
|
||||
class DIALOG_ERC : public DIALOG_ERC_BASE
|
||||
{
|
||||
private:
|
||||
SCH_EDIT_FRAME* m_parent;
|
||||
bool m_initialized;
|
||||
const SCH_MARKER* m_lastMarkerFound;
|
||||
SCH_EDIT_FRAME* m_parent;
|
||||
|
||||
RC_ITEMS_PROVIDER* m_markerProvider;
|
||||
RC_TREE_MODEL* m_markerTreeModel;
|
||||
|
||||
int m_severities;
|
||||
|
||||
public:
|
||||
DIALOG_ERC( SCH_EDIT_FRAME* parent );
|
||||
~DIALOG_ERC();
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
// from DIALOG_ERC_BASE:
|
||||
void OnCloseErcDialog( wxCloseEvent& event ) override;
|
||||
void OnErcCmpClick( wxCommandEvent& 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();
|
||||
|
||||
// Click on a marker info:
|
||||
void OnLeftClickMarkersList( wxHtmlLinkEvent& event ) override;
|
||||
|
||||
// Double click on a marker info:
|
||||
void OnLeftDblClickMarkersList( wxMouseEvent& event ) override;
|
||||
|
||||
void TestErc( REPORTER& aReporter );
|
||||
void DisplayERC_MarkersList();
|
||||
void updateMarkerCounts( SCH_SCREENS *screens );
|
||||
|
||||
bool writeReport( const wxString& aFullFileName );
|
||||
|
||||
void deleteAllMarkers();
|
||||
|
||||
void syncCheckboxes();
|
||||
void updateDisplayedCounts();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_erc_listbox.h"
|
||||
|
||||
#include "dialog_erc_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -24,41 +22,6 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
|
|||
wxBoxSizer* bupperSizer;
|
||||
bupperSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxStaticBoxSizer* sdiagSizer;
|
||||
sdiagSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("ERC Report:") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizer1;
|
||||
fgSizer1 = new wxFlexGridSizer( 0, 2, 5, 5 );
|
||||
fgSizer1->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_ErcTotalErrorsText = new wxStaticText( sdiagSizer->GetStaticBox(), wxID_ANY, _("Total:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ErcTotalErrorsText->Wrap( -1 );
|
||||
fgSizer1->Add( m_ErcTotalErrorsText, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_TotalErrCount = new wxTextCtrl( sdiagSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
|
||||
fgSizer1->Add( m_TotalErrCount, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_WarnErcErrorsText = new wxStaticText( sdiagSizer->GetStaticBox(), wxID_ANY, _("Warnings:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_WarnErcErrorsText->Wrap( -1 );
|
||||
fgSizer1->Add( m_WarnErcErrorsText, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_LastWarningCount = new wxTextCtrl( sdiagSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
|
||||
fgSizer1->Add( m_LastWarningCount, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_LastErrCountText = new wxStaticText( sdiagSizer->GetStaticBox(), wxID_ANY, _("Errors:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_LastErrCountText->Wrap( -1 );
|
||||
fgSizer1->Add( m_LastErrCountText, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_LastErrCount = new wxTextCtrl( sdiagSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
|
||||
fgSizer1->Add( m_LastErrCount, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
sdiagSizer->Add( fgSizer1, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bupperSizer->Add( sdiagSizer, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
wxBoxSizer* bSizerMessages;
|
||||
bSizerMessages = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
@ -66,37 +29,85 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
|
|||
m_titleMessages->Wrap( -1 );
|
||||
m_titleMessages->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
|
||||
|
||||
bSizerMessages->Add( m_titleMessages, 0, wxRIGHT|wxLEFT, 12 );
|
||||
bSizerMessages->Add( m_titleMessages, 0, wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
m_MessagesList = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
|
||||
m_MessagesList->SetMinSize( wxSize( 180,-1 ) );
|
||||
m_MessagesList->SetMinSize( wxSize( 180,110 ) );
|
||||
|
||||
bSizerMessages->Add( m_MessagesList, 1, wxEXPAND|wxBOTTOM|wxLEFT, 5 );
|
||||
bSizerMessages->Add( m_MessagesList, 1, wxEXPAND|wxLEFT, 5 );
|
||||
|
||||
|
||||
bupperSizer->Add( bSizerMessages, 1, wxBOTTOM|wxEXPAND|wxRIGHT|wxTOP, 3 );
|
||||
bupperSizer->Add( bSizerMessages, 1, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
bercSizer->Add( bupperSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 8 );
|
||||
bercSizer->Add( bupperSizer, 1, wxEXPAND|wxTOP|wxRIGHT, 5 );
|
||||
|
||||
m_textMarkers = new wxStaticText( this, wxID_ANY, _("Error List:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textMarkers = new wxStaticText( this, wxID_ANY, _("Violations:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textMarkers->Wrap( -1 );
|
||||
m_textMarkers->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
|
||||
|
||||
bercSizer->Add( m_textMarkers, 0, wxLEFT|wxRIGHT, 20 );
|
||||
bercSizer->Add( m_textMarkers, 0, wxTOP|wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
m_MarkersList = new ERC_HTML_LISTFRAME( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO|wxBORDER_SIMPLE );
|
||||
m_MarkersList->SetMinSize( wxSize( 460,200 ) );
|
||||
m_markerDataView = new wxDataViewCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_NO_HEADER );
|
||||
m_markerDataView->SetToolTip( _("Click on items to highlight them on the board.") );
|
||||
m_markerDataView->SetMinSize( wxSize( -1,200 ) );
|
||||
|
||||
bercSizer->Add( m_MarkersList, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 );
|
||||
bercSizer->Add( m_markerDataView, 2, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxBoxSizer* bSeveritySizer;
|
||||
bSeveritySizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_showLabel = new wxStaticText( this, wxID_ANY, _("Show:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_showLabel->Wrap( -1 );
|
||||
bSeveritySizer->Add( m_showLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_showAll = new wxCheckBox( this, wxID_ANY, _("All"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSeveritySizer->Add( m_showAll, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
bSizer1->Add( bercSizer, 1, wxEXPAND, 5 );
|
||||
bSeveritySizer->Add( 35, 0, 0, wxEXPAND, 5 );
|
||||
|
||||
m_showErrors = new wxCheckBox( this, wxID_ANY, _("Errors"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSeveritySizer->Add( m_showErrors, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_errorsBadge = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_errorsBadge->SetMinSize( wxSize( 20,20 ) );
|
||||
|
||||
bSeveritySizer->Add( m_errorsBadge, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 25 );
|
||||
|
||||
m_showWarnings = new wxCheckBox( this, wxID_ANY, _("Warnings"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSeveritySizer->Add( m_showWarnings, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_warningsBadge = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_warningsBadge->SetMinSize( wxSize( 20,20 ) );
|
||||
|
||||
bSeveritySizer->Add( m_warningsBadge, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 25 );
|
||||
|
||||
m_showExclusions = new wxCheckBox( this, wxID_ANY, _("Exclusions"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSeveritySizer->Add( m_showExclusions, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_exclusionsBadge = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSeveritySizer->Add( m_exclusionsBadge, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 25 );
|
||||
|
||||
|
||||
bSeveritySizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_saveReport = new wxButton( this, wxID_ANY, _("Save..."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSeveritySizer->Add( m_saveReport, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
bercSizer->Add( bSeveritySizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
bSizer1->Add( bercSizer, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 8 );
|
||||
|
||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizer1->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_buttondelmarkers = new wxButton( this, ID_ERASE_DRC_MARKERS, _("Delete Markers"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_buttonsSizer->Add( m_buttondelmarkers, 0, wxALL|wxEXPAND, 5 );
|
||||
m_buttonsSizer->Add( m_buttondelmarkers, 0, wxEXPAND|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 8 );
|
||||
|
||||
|
||||
m_buttonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
@ -108,10 +119,10 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
|
|||
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
|
||||
m_sdbSizer1->Realize();
|
||||
|
||||
m_buttonsSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 );
|
||||
m_buttonsSizer->Add( m_sdbSizer1, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
|
||||
bSizer1->Add( m_buttonsSizer, 0, wxEXPAND|wxLEFT, 10 );
|
||||
bSizer1->Add( m_buttonsSizer, 0, wxEXPAND|wxLEFT, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizer1 );
|
||||
|
@ -120,21 +131,33 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
|
|||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_ERC_BASE::OnCloseErcDialog ) );
|
||||
m_MarkersList->Connect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_ERC_BASE::OnLeftClickMarkersList ), NULL, this );
|
||||
m_MarkersList->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_ERC_BASE::OnLeftDblClickMarkersList ), NULL, this );
|
||||
m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemDClick ), NULL, this );
|
||||
m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemRClick ), NULL, this );
|
||||
m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemSelected ), NULL, this );
|
||||
m_showAll->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this );
|
||||
m_showErrors->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this );
|
||||
m_showWarnings->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this );
|
||||
m_showExclusions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this );
|
||||
m_saveReport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSaveReport ), NULL, this );
|
||||
m_buttondelmarkers->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnEraseDrcMarkersClick ), NULL, this );
|
||||
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnButtonCloseClick ), NULL, this );
|
||||
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnErcCmpClick ), NULL, this );
|
||||
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnRunERCClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_ERC_BASE::~DIALOG_ERC_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_ERC_BASE::OnCloseErcDialog ) );
|
||||
m_MarkersList->Disconnect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_ERC_BASE::OnLeftClickMarkersList ), NULL, this );
|
||||
m_MarkersList->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( DIALOG_ERC_BASE::OnLeftDblClickMarkersList ), NULL, this );
|
||||
m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemDClick ), NULL, this );
|
||||
m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemRClick ), NULL, this );
|
||||
m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemSelected ), NULL, this );
|
||||
m_showAll->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this );
|
||||
m_showErrors->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this );
|
||||
m_showWarnings->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this );
|
||||
m_showExclusions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this );
|
||||
m_saveReport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSaveReport ), NULL, this );
|
||||
m_buttondelmarkers->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnEraseDrcMarkersClick ), NULL, this );
|
||||
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnButtonCloseClick ), NULL, this );
|
||||
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnErcCmpClick ), NULL, this );
|
||||
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnRunERCClick ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,8 +10,6 @@
|
|||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class ERC_HTML_LISTFRAME;
|
||||
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
|
@ -21,12 +19,14 @@ class ERC_HTML_LISTFRAME;
|
|||
#include <wx/settings.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/html/htmlwin.h>
|
||||
#include <wx/dataview.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/statbmp.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -41,16 +41,20 @@ class DIALOG_ERC_BASE : public DIALOG_SHIM
|
|||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_ErcTotalErrorsText;
|
||||
wxTextCtrl* m_TotalErrCount;
|
||||
wxStaticText* m_WarnErcErrorsText;
|
||||
wxTextCtrl* m_LastWarningCount;
|
||||
wxStaticText* m_LastErrCountText;
|
||||
wxTextCtrl* m_LastErrCount;
|
||||
wxStaticText* m_titleMessages;
|
||||
wxTextCtrl* m_MessagesList;
|
||||
wxStaticText* m_textMarkers;
|
||||
ERC_HTML_LISTFRAME* m_MarkersList;
|
||||
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;
|
||||
|
@ -59,11 +63,14 @@ class DIALOG_ERC_BASE : public DIALOG_SHIM
|
|||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnCloseErcDialog( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void OnLeftClickMarkersList( wxHtmlLinkEvent& event ) { event.Skip(); }
|
||||
virtual void OnLeftDblClickMarkersList( wxMouseEvent& event ) { event.Skip(); }
|
||||
virtual void OnERCItemDClick( wxDataViewEvent& event ) { event.Skip(); }
|
||||
virtual void OnERCItemRClick( wxDataViewEvent& event ) { event.Skip(); }
|
||||
virtual void OnERCItemSelected( wxDataViewEvent& event ) { event.Skip(); }
|
||||
virtual void OnSeverity( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSaveReport( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnEraseDrcMarkersClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonCloseClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnErcCmpClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnRunERCClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <panel_setup_formatting.h>
|
||||
#include <panel_setup_pinmap.h>
|
||||
#include <eeschema_config.h>
|
||||
#include <erc_item.h>
|
||||
#include "dialog_schematic_setup.h"
|
||||
#include "panel_eeschema_template_fieldnames.h"
|
||||
|
||||
|
@ -40,7 +41,9 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
|
|||
m_formatting = new PANEL_SETUP_FORMATTING( this, aFrame );
|
||||
m_fieldNameTemplates = new PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( aFrame, this, false );
|
||||
m_pinMap = new PANEL_SETUP_PINMAP( this, aFrame );
|
||||
m_severities = new PANEL_SETUP_SEVERITIES( this, aFrame->GetErcSettings().m_Severities,
|
||||
|
||||
ERC_ITEM dummyItem;
|
||||
m_severities = new PANEL_SETUP_SEVERITIES( this, dummyItem, g_ErcSettings->m_Severities,
|
||||
ERCE_FIRST, ERCE_LAST );
|
||||
/*
|
||||
* WARNING: If you change page names you MUST update calls to DoShowSchematicSetupDialog().
|
||||
|
|
|
@ -1,163 +0,0 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
/* class_drc_erc_item.cpp - DRC_ITEM class functions for eeschema */
|
||||
/******************************************************************/
|
||||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
|
||||
#include <drc_item.h>
|
||||
#include <erc.h>
|
||||
#include <base_units.h>
|
||||
|
||||
wxString DRC_ITEM::GetErrorText() const
|
||||
{
|
||||
switch( m_ErrorCode )
|
||||
{
|
||||
case ERCE_UNSPECIFIED:
|
||||
return wxString( _("ERC err unspecified") );
|
||||
case ERCE_DUPLICATE_SHEET_NAME:
|
||||
return wxString( _("Duplicate sheet names within a given sheet") );
|
||||
case ERCE_PIN_NOT_CONNECTED:
|
||||
return wxString( _("Pin not connected (use a \"no connection\" flag to suppress this error)") );
|
||||
case ERCE_PIN_NOT_DRIVEN:
|
||||
return wxString( _( "Pin connected to other pins, but not driven by any pin" ) );
|
||||
case ERCE_PIN_TO_PIN_WARNING:
|
||||
return wxString( _("Conflict problem between pins. Severity: warning") );
|
||||
case ERCE_PIN_TO_PIN_ERROR:
|
||||
return wxString( _("Conflict problem between pins. Severity: error") );
|
||||
case ERCE_HIERACHICAL_LABEL:
|
||||
return wxString( _("Mismatch between hierarchical labels and pins sheets") );
|
||||
case ERCE_NOCONNECT_CONNECTED:
|
||||
return wxString( _("A pin with a \"no connection\" flag is connected") );
|
||||
case ERCE_NOCONNECT_NOT_CONNECTED:
|
||||
return wxString( _("A \"no connection\" flag is not connected to anything") );
|
||||
case ERCE_LABEL_NOT_CONNECTED:
|
||||
return wxString( _("Label not connected anywhere else in the schematic") );
|
||||
case ERCE_SIMILAR_LABELS:
|
||||
return wxString( _("Labels are similar (lower/upper case difference only)" ) );
|
||||
case ERCE_SIMILAR_GLBL_LABELS:
|
||||
return wxString( _("Global labels are similar (lower/upper case difference only)" ) );
|
||||
case ERCE_DIFFERENT_UNIT_FP:
|
||||
return wxString( _("Different footprint assigned in another unit of the same component" ) );
|
||||
case ERCE_DIFFERENT_UNIT_NET:
|
||||
return wxString( _("Different net assigned to a shared pin in another unit of the same component" ) );
|
||||
case ERCE_BUS_ALIAS_CONFLICT:
|
||||
return wxString( _("Conflict between bus alias definitions across schematic sheets") );
|
||||
case ERCE_DRIVER_CONFLICT:
|
||||
return wxString( _( "More than one name given to this bus or net" ) );
|
||||
case ERCE_BUS_ENTRY_CONFLICT:
|
||||
return wxString( _( "Net is graphically connected to a bus but not a bus member" ) );
|
||||
case ERCE_BUS_LABEL_ERROR:
|
||||
return wxString( _( "Label attached to bus item does not describe a bus" ) );
|
||||
case ERCE_BUS_TO_BUS_CONFLICT:
|
||||
return wxString( _( "No nets are shared between two bus items" ) );
|
||||
case ERCE_BUS_TO_NET_CONFLICT:
|
||||
return wxString( _( "Invalid connection between bus and net items" ) );
|
||||
case ERCE_GLOBLABEL:
|
||||
return wxString( _( "Global label not connected anywhere else in the schematic" ) );
|
||||
default:
|
||||
wxFAIL_MSG( "Missing ERC error description" );
|
||||
return wxString( wxT("Unknown.") );
|
||||
}
|
||||
}
|
||||
|
||||
wxString DRC_ITEM::ShowCoord( EDA_UNITS aUnits, const wxPoint& aPos )
|
||||
{
|
||||
return wxString::Format( "@(%s, %s)",
|
||||
MessageTextFromValue( aUnits, aPos.x ),
|
||||
MessageTextFromValue( aUnits, aPos.y ) );
|
||||
}
|
||||
|
||||
|
||||
wxString DRC_ITEM::ShowHtml( EDA_UNITS aUnits ) const
|
||||
{
|
||||
wxString mainText = m_MainText;
|
||||
// a wxHtmlWindows does not like < and > in the text to display
|
||||
// because these chars have a special meaning in html
|
||||
mainText.Replace( wxT("<"), wxT("<") );
|
||||
mainText.Replace( wxT(">"), wxT(">") );
|
||||
|
||||
wxString errText = GetErrorText();
|
||||
errText.Replace( wxT("<"), wxT("<") );
|
||||
errText.Replace( wxT(">"), wxT(">") );
|
||||
|
||||
wxColour hrefColour = wxSystemSettings::GetColour( wxSYS_COLOUR_HOTLIGHT );
|
||||
|
||||
if( !m_hasPositions )
|
||||
{
|
||||
// omit the coordinate, a NETCLASS has no location
|
||||
return wxString::Format( "<p><b>%s</b><br> %s", errText, mainText );
|
||||
}
|
||||
else if( m_hasSecondItem )
|
||||
{
|
||||
wxString auxText = m_AuxText;
|
||||
auxText.Replace( wxT("<"), wxT("<") );
|
||||
auxText.Replace( wxT(">"), wxT(">") );
|
||||
|
||||
// an html fragment for the entire message in the listbox. feel free
|
||||
// to add color if you want:
|
||||
return wxString::Format( "<p><b>%s</b><br> <font color='%s'><a href=''>%s</a></font>: %s<br> %s: %s",
|
||||
errText,
|
||||
hrefColour.GetAsString( wxC2S_HTML_SYNTAX ),
|
||||
ShowCoord( aUnits, m_MainPosition ),
|
||||
mainText,
|
||||
ShowCoord( aUnits, m_AuxPosition ),
|
||||
auxText );
|
||||
}
|
||||
else
|
||||
{
|
||||
return wxString::Format( "<p><b>%s</b><br> <font color='%s'><a href=''>%s</a></font>: %s",
|
||||
errText,
|
||||
hrefColour.GetAsString( wxC2S_HTML_SYNTAX ),
|
||||
ShowCoord( aUnits, m_MainPosition ),
|
||||
mainText );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxString DRC_ITEM::ShowReport( EDA_UNITS aUnits ) const
|
||||
{
|
||||
if( m_hasSecondItem )
|
||||
{
|
||||
return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n %s: %s\n" ),
|
||||
m_ErrorCode,
|
||||
GetErrorText(),
|
||||
ShowCoord( aUnits, m_MainPosition ),
|
||||
m_MainText,
|
||||
ShowCoord( aUnits, m_AuxPosition ),
|
||||
m_AuxText );
|
||||
}
|
||||
else
|
||||
{
|
||||
return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n" ),
|
||||
m_ErrorCode,
|
||||
GetErrorText(),
|
||||
ShowCoord( aUnits, m_MainPosition ),
|
||||
m_MainText );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -42,13 +42,11 @@
|
|||
#include <sch_edit_frame.h>
|
||||
#include <sch_junction.h>
|
||||
#include <sch_painter.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <settings/app_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <symbol_lib_table.h>
|
||||
#include <widgets/paged_dialog.h>
|
||||
#include <widgets/symbol_tree_pane.h>
|
||||
//#include <widgets/widget_eeschema_color_config.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <widgets/ui_common.h>
|
||||
|
@ -138,15 +136,9 @@ public:
|
|||
if( aConfig->Read( wxT( "ERC_TestSimilarLabels" ), &flag, true ) )
|
||||
{
|
||||
if( flag )
|
||||
{
|
||||
m_Pt_param->m_Severities[ ERCE_SIMILAR_GLBL_LABELS ] = RPT_SEVERITY_WARNING;
|
||||
m_Pt_param->m_Severities[ ERCE_SIMILAR_LABELS ] = RPT_SEVERITY_WARNING;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Pt_param->m_Severities[ ERCE_SIMILAR_GLBL_LABELS ] = RPT_SEVERITY_IGNORE;
|
||||
m_Pt_param->m_Severities[ ERCE_SIMILAR_LABELS ] = RPT_SEVERITY_IGNORE;
|
||||
}
|
||||
}
|
||||
|
||||
if( aConfig->Read( wxT( "ERC_CheckUniqueGlobalLabels" ), &flag, true ) )
|
||||
|
@ -206,7 +198,7 @@ public:
|
|||
// TO DO: for now just write out the legacy ones so we don't lose them
|
||||
// TO DO: remove this once the new scheme is in place
|
||||
aConfig->Write( wxT( "ERC_TestSimilarLabels" ),
|
||||
m_Pt_param->IsTestEnabled( ERCE_SIMILAR_GLBL_LABELS ) );
|
||||
m_Pt_param->IsTestEnabled( ERCE_SIMILAR_LABELS ) );
|
||||
aConfig->Write( wxT( "ERC_CheckUniqueGlobalLabels" ),
|
||||
m_Pt_param->IsTestEnabled( ERCE_GLOBLABEL ) );
|
||||
aConfig->Write( wxT( "ERC_CheckBusDriverConflicts" ),
|
||||
|
@ -223,6 +215,17 @@ public:
|
|||
};
|
||||
|
||||
|
||||
int GetSeverity( int aErrorCode )
|
||||
{
|
||||
return g_ErcSettings->m_Severities[ aErrorCode ];
|
||||
}
|
||||
|
||||
void SetSeverity( int aErrorCode, int aSeverity )
|
||||
{
|
||||
g_ErcSettings->m_Severities[ aErrorCode ] = aSeverity;
|
||||
}
|
||||
|
||||
|
||||
int GetDefaultBusThickness()
|
||||
{
|
||||
return s_defaultBusThickness;
|
||||
|
@ -391,12 +394,8 @@ std::vector<PARAM_CFG*>& SCH_EDIT_FRAME::GetProjectFileParameters()
|
|||
|
||||
params.push_back( new PARAM_CFG_FILENAME( wxT( "PageLayoutDescrFile" ),
|
||||
&BASE_SCREEN::m_PageLayoutDescrFileName ) );
|
||||
|
||||
params.push_back( new PARAM_CFG_FILENAME( wxT( "PlotDirectoryName" ),
|
||||
&m_plotDirectoryName ) );
|
||||
|
||||
params.push_back( new PARAM_CFG_WXSTRING( wxT( "NetFmtName" ),
|
||||
&m_netListFormat) );
|
||||
params.push_back( new PARAM_CFG_FILENAME( wxT( "PlotDirectoryName" ), &m_plotDirectoryName ) );
|
||||
params.push_back( new PARAM_CFG_WXSTRING( wxT( "NetFmtName" ), &m_netListFormat) );
|
||||
params.push_back( new PARAM_CFG_BOOL( wxT( "SpiceAjustPassiveValues" ),
|
||||
&m_spiceAjustPassiveValues, false ) );
|
||||
|
||||
|
@ -404,7 +403,7 @@ std::vector<PARAM_CFG*>& SCH_EDIT_FRAME::GetProjectFileParameters()
|
|||
|
||||
params.push_back( new PARAM_CFG_FIELDNAMES( &m_templateFieldNames ) );
|
||||
|
||||
params.push_back( new PARAM_CFG_SEVERITIES( &m_ercSettings ) );
|
||||
params.push_back( new PARAM_CFG_SEVERITIES( g_ErcSettings ) );
|
||||
|
||||
return params;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <settings/parameters.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <wx/config.h>
|
||||
|
||||
#include <widgets/ui_common.h>
|
||||
|
||||
///! Update the schema version whenever a migration is required
|
||||
const int eeschemaSchemaVersion = 0;
|
||||
|
@ -43,6 +43,9 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : APP_SETTINGS_BASE( "eeschema", eeschema
|
|||
m_params.emplace_back( new PARAM<wxString>( "appearance.edit_sheet_visible_columns",
|
||||
&m_Appearance.edit_sheet_visible_columns, "0 1 2 3 4 5 6 7" ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "appearance.erc_severities",
|
||||
&m_Appearance.erc_severities, RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "appearance.footprint_preview",
|
||||
&m_Appearance.footprint_preview, true ) );
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
{
|
||||
wxString edit_component_visible_columns;
|
||||
wxString edit_sheet_visible_columns;
|
||||
int erc_severities;
|
||||
bool footprint_preview;
|
||||
bool navigator_stays_open;
|
||||
bool print_sheet_reference;
|
||||
|
|
307
eeschema/erc.cpp
307
eeschema/erc.cpp
|
@ -164,33 +164,27 @@ int TestDuplicateSheetNames( bool aCreateMarker )
|
|||
{
|
||||
std::vector<SCH_SHEET*> list;
|
||||
|
||||
for( auto item : screen->Items().OfType( SCH_SHEET_T ) )
|
||||
for( SCH_ITEM* item : screen->Items().OfType( SCH_SHEET_T ) )
|
||||
list.push_back( static_cast<SCH_SHEET*>( item ) );
|
||||
|
||||
for( size_t i = 0; i < list.size(); i++ )
|
||||
{
|
||||
auto item = list[i];
|
||||
SCH_SHEET* item = list[i];
|
||||
|
||||
for( size_t j = i + 1; j < list.size(); j++ )
|
||||
{
|
||||
auto test_item = list[j];
|
||||
SCH_SHEET* test_item = list[j];
|
||||
|
||||
// We have found a second sheet: compare names
|
||||
// we are using case insensitive comparison to avoid mistakes between
|
||||
// similar names like Mysheet and mysheet
|
||||
if( ( (SCH_SHEET*) item )->GetName().CmpNoCase(
|
||||
( ( SCH_SHEET* ) test_item )->GetName() ) == 0 )
|
||||
if( item->GetName().CmpNoCase( test_item->GetName() ) == 0 )
|
||||
{
|
||||
if( aCreateMarker )
|
||||
{
|
||||
/* Create a new marker type ERC error*/
|
||||
SCH_MARKER* marker = new SCH_MARKER();
|
||||
marker->SetData( ERCE_DUPLICATE_SHEET_NAME,
|
||||
( (SCH_SHEET*) test_item )->GetPosition(),
|
||||
_( "Duplicate sheet name" ),
|
||||
( (SCH_SHEET*) test_item )->GetPosition() );
|
||||
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_ERROR );
|
||||
SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( EDA_UNITS::UNSCALED, ERCE_DUPLICATE_SHEET_NAME,
|
||||
item->GetPosition(), item, test_item );
|
||||
screen->Append( marker );
|
||||
}
|
||||
|
||||
|
@ -204,10 +198,9 @@ int TestDuplicateSheetNames( bool aCreateMarker )
|
|||
}
|
||||
|
||||
|
||||
int TestConflictingBusAliases( bool aCreateMarker )
|
||||
int TestConflictingBusAliases()
|
||||
{
|
||||
wxString msg;
|
||||
wxPoint dummyPos( 0, 0 );
|
||||
int err_count = 0;
|
||||
SCH_SCREENS screens;
|
||||
std::vector< std::shared_ptr<BUS_ALIAS> > aliases;
|
||||
|
@ -222,21 +215,14 @@ int TestConflictingBusAliases( bool aCreateMarker )
|
|||
{
|
||||
if( alias->GetName() == test->GetName() && alias->Members() != test->Members() )
|
||||
{
|
||||
if( aCreateMarker )
|
||||
{
|
||||
msg = wxString::Format( _( "Bus alias %s has conflicting definitions on"
|
||||
" multiple sheets: %s and %s" ),
|
||||
alias->GetName(),
|
||||
alias->GetParent()->GetFileName(),
|
||||
test->GetParent()->GetFileName() );
|
||||
msg.Printf( _( "Bus alias %s has conflicting definitions on %s and %s" ),
|
||||
alias->GetName(),
|
||||
alias->GetParent()->GetFileName(),
|
||||
test->GetParent()->GetFileName() );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER();
|
||||
marker->SetData( ERCE_BUS_ALIAS_CONFLICT, dummyPos, msg, dummyPos );
|
||||
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_ERROR );
|
||||
|
||||
test->GetParent()->Append( marker );
|
||||
}
|
||||
SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( ERCE_BUS_ALIAS_CONFLICT, wxPoint(), msg );
|
||||
test->GetParent()->Append( marker );
|
||||
|
||||
++err_count;
|
||||
}
|
||||
|
@ -270,45 +256,41 @@ int TestMultiunitFootprints( SCH_SHEET_LIST& aSheetList )
|
|||
// Reference footprint
|
||||
wxString fp;
|
||||
wxString unitName;
|
||||
KIID unitID;
|
||||
|
||||
for( unsigned i = 0; i < component.second.GetCount(); ++i )
|
||||
{
|
||||
SCH_COMPONENT* cmp = refList.GetItem( i ).GetComp();
|
||||
SCH_COMPONENT* unit = refList.GetItem( i ).GetComp();
|
||||
SCH_SHEET_PATH sheetPath = refList.GetItem( i ).GetSheetPath();
|
||||
fp = cmp->GetField( FOOTPRINT )->GetText();
|
||||
fp = unit->GetField( FOOTPRINT )->GetText();
|
||||
|
||||
if( !fp.IsEmpty() )
|
||||
{
|
||||
unitName = cmp->GetRef( &sheetPath )
|
||||
+ LIB_PART::SubReference( cmp->GetUnit(), false );
|
||||
unitName = unit->GetRef( &sheetPath, true );
|
||||
unitID = unit->m_Uuid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for( unsigned i = 0; i < component.second.GetCount(); ++i )
|
||||
{
|
||||
SCH_REFERENCE& ref = refList.GetItem( i );
|
||||
SCH_COMPONENT* unit = ref.GetComp();
|
||||
SCH_SHEET_PATH sheetPath = refList.GetItem( i ).GetSheetPath();
|
||||
const wxString curFp = unit->GetField( FOOTPRINT )->GetText();
|
||||
SCH_REFERENCE& secondRef = refList.GetItem( i );
|
||||
SCH_COMPONENT* secondUnit = secondRef.GetComp();
|
||||
SCH_SHEET_PATH sheetPath = secondRef.GetSheetPath();
|
||||
|
||||
if( !curFp.IsEmpty() && fp != curFp )
|
||||
const wxString secondFp = secondUnit->GetField( FOOTPRINT )->GetText();
|
||||
wxString secondName = secondUnit->GetRef( &sheetPath, true );
|
||||
KIID secondID = secondUnit->m_Uuid;
|
||||
|
||||
if( !secondFp.IsEmpty() && fp != secondFp )
|
||||
{
|
||||
wxString curUnitName = unit->GetRef( &sheetPath )
|
||||
+ LIB_PART::SubReference( unit->GetUnit(), false );
|
||||
wxString msg = wxString::Format( _( "Unit %s has '%s' assigned, "
|
||||
"whereas unit %s has '%s' assigned" ),
|
||||
unitName,
|
||||
fp,
|
||||
curUnitName,
|
||||
curFp );
|
||||
wxPoint pos = unit->GetPosition();
|
||||
wxString description = _( "%s has '%s' assigned" );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER();
|
||||
marker->SetData( ERCE_DIFFERENT_UNIT_FP, pos, msg, pos );
|
||||
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_WARNING );
|
||||
ref.GetSheetPath().LastScreen()->Append( marker );
|
||||
SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( ERCE_DIFFERENT_UNIT_FP, secondUnit->GetPosition(),
|
||||
wxString::Format( description, unitName, fp ), unitID,
|
||||
wxString::Format( description, secondName, secondFp ), secondID );
|
||||
secondRef.GetSheetPath().LastScreen()->Append( marker );
|
||||
|
||||
++errors;
|
||||
}
|
||||
|
@ -321,74 +303,33 @@ int TestMultiunitFootprints( SCH_SHEET_LIST& aSheetList )
|
|||
|
||||
void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst, int aMinConn, int aDiag )
|
||||
{
|
||||
SCH_MARKER* marker = NULL;
|
||||
SCH_SCREEN* screen;
|
||||
ELECTRICAL_PINTYPE ii, jj;
|
||||
|
||||
if( aDiag == OK || aMinConn < 1 )
|
||||
if( aDiag == OK || aMinConn < 1 || aNetItemRef->m_Type != NETLIST_ITEM::PIN )
|
||||
return;
|
||||
|
||||
SCH_PIN* pin = static_cast<SCH_PIN*>( aNetItemRef->m_Comp );
|
||||
|
||||
/* Create new marker for ERC error. */
|
||||
marker = new SCH_MARKER();
|
||||
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_WARNING );
|
||||
screen = aNetItemRef->m_SheetPath.LastScreen();
|
||||
screen->Append( marker );
|
||||
SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
aNetItemRef->m_SheetPath.LastScreen()->Append( marker );
|
||||
|
||||
wxString msg;
|
||||
|
||||
ii = aNetItemRef->m_ElectricalPinType;
|
||||
|
||||
wxString cmp_ref( "?" );
|
||||
|
||||
if( aNetItemRef->m_Type == NETLIST_ITEM::PIN && aNetItemRef->m_Link )
|
||||
cmp_ref = aNetItemRef->GetComponentParent()->GetRef( &aNetItemRef->m_SheetPath );
|
||||
|
||||
if( aNetItemTst == NULL )
|
||||
if( aNetItemTst == NULL)
|
||||
{
|
||||
if( aMinConn == NOD ) /* Nothing driving the net. */
|
||||
{
|
||||
if( aNetItemRef->m_Type == NETLIST_ITEM::PIN && aNetItemRef->m_Link )
|
||||
cmp_ref = aNetItemRef->GetComponentParent()->GetRef(
|
||||
&aNetItemRef->m_SheetPath );
|
||||
|
||||
msg.Printf( _( "Pin %s (%s) of component %s is not driven (Net %d)." ),
|
||||
aNetItemRef->m_PinNum,
|
||||
GetChars( GetText( ii ) ),
|
||||
GetChars( cmp_ref ),
|
||||
aNetItemRef->GetNet() );
|
||||
marker->SetData( ERCE_PIN_NOT_DRIVEN, aNetItemRef->m_Start, msg, aNetItemRef->m_Start );
|
||||
marker->SetData( ERCE_PIN_NOT_DRIVEN, aNetItemRef->m_Start,
|
||||
pin->GetDescription( &aNetItemRef->m_SheetPath ), pin->m_Uuid );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( aNetItemTst ) /* Error between 2 pins */
|
||||
if( aNetItemTst && aNetItemTst->m_Type == NETLIST_ITEM::PIN ) /* Error between 2 pins */
|
||||
{
|
||||
jj = aNetItemTst->m_ElectricalPinType;
|
||||
int errortype = ERCE_PIN_TO_PIN_WARNING;
|
||||
SCH_PIN* pinB = static_cast<SCH_PIN*>( aNetItemTst->m_Comp );
|
||||
|
||||
if( aDiag == ERR )
|
||||
{
|
||||
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_ERROR );
|
||||
errortype = ERCE_PIN_TO_PIN_ERROR;
|
||||
}
|
||||
|
||||
wxString alt_cmp( "?" );
|
||||
|
||||
if( aNetItemTst->m_Type == NETLIST_ITEM::PIN && aNetItemTst->m_Link )
|
||||
alt_cmp = aNetItemTst->GetComponentParent()->GetRef( &aNetItemTst->m_SheetPath );
|
||||
|
||||
msg.Printf( _( "Pin %s (%s) of component %s is connected to " ),
|
||||
aNetItemRef->m_PinNum,
|
||||
GetChars( GetText( ii ) ),
|
||||
GetChars( cmp_ref ) );
|
||||
marker->SetData( errortype, aNetItemRef->m_Start, msg, aNetItemRef->m_Start );
|
||||
msg.Printf( _( "pin %s (%s) of component %s (net %d)." ),
|
||||
aNetItemTst->m_PinNum,
|
||||
GetChars( GetText( jj ) ),
|
||||
GetChars( alt_cmp ),
|
||||
aNetItemRef->GetNet() );
|
||||
marker->SetAuxiliaryData( msg, aNetItemTst->m_Start );
|
||||
marker->SetData( aDiag == ERR ? ERCE_PIN_TO_PIN_ERROR : ERCE_PIN_TO_PIN_WARNING,
|
||||
aNetItemRef->m_Start,
|
||||
pin->GetDescription( &aNetItemRef->m_SheetPath ), pin->m_Uuid,
|
||||
pinB->GetDescription( &aNetItemTst->m_SheetPath ), pinB->m_Uuid );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -514,10 +455,10 @@ void TestOthersItems( NETLIST_OBJECT_LIST* aList, unsigned aNetItemRef, unsigned
|
|||
{
|
||||
if( aList->GetConnectionType( netItemTst ) == NET_CONNECTION::UNCONNECTED )
|
||||
{
|
||||
Diagnose( aList->GetItem( aNetItemRef ), aList->GetItem( netItemTst ), 0,
|
||||
erc );
|
||||
aList->SetConnectionType(
|
||||
netItemTst, NET_CONNECTION::NOCONNECT_SYMBOL_PRESENT );
|
||||
Diagnose( aList->GetItem( aNetItemRef ), aList->GetItem( netItemTst ),
|
||||
0, erc );
|
||||
aList->SetConnectionType( netItemTst,
|
||||
NET_CONNECTION::NOCONNECT_SYMBOL_PRESENT );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -527,111 +468,6 @@ void TestOthersItems( NETLIST_OBJECT_LIST* aList, unsigned aNetItemRef, unsigned
|
|||
}
|
||||
}
|
||||
|
||||
int NETLIST_OBJECT_LIST::CountPinsInNet( unsigned aNetStart )
|
||||
{
|
||||
int count = 0;
|
||||
int curr_net = GetItemNet( aNetStart );
|
||||
|
||||
/* Test pins connected to NetItemRef */
|
||||
for( unsigned item = aNetStart; item < size(); item++ )
|
||||
{
|
||||
// We examine only a given net. We stop the search if the net changes
|
||||
if( curr_net != GetItemNet( item ) ) // End of net
|
||||
break;
|
||||
|
||||
if( GetItemType( item ) == NETLIST_ITEM::PIN )
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
bool WriteDiagnosticERC( EDA_UNITS aUnits, const wxString& aFullFileName )
|
||||
{
|
||||
wxFFile file( aFullFileName, wxT( "wt" ) );
|
||||
|
||||
if( !file.IsOpened() )
|
||||
return false;
|
||||
|
||||
wxString msg = wxString::Format( _( "ERC report (%s, Encoding UTF8)\n" ), DateAndTime() );
|
||||
int err_count = 0;
|
||||
int warn_count = 0;
|
||||
int total_count = 0;
|
||||
SCH_SHEET_LIST sheetList( g_RootSheet );
|
||||
|
||||
for( unsigned i = 0; i < sheetList.size(); i++ )
|
||||
{
|
||||
msg << wxString::Format( _( "\n***** Sheet %s\n" ),
|
||||
GetChars( sheetList[i].PathHumanReadable() ) );
|
||||
|
||||
for( auto aItem : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
|
||||
{
|
||||
auto marker = static_cast<const SCH_MARKER*>( aItem );
|
||||
|
||||
if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
|
||||
continue;
|
||||
|
||||
total_count++;
|
||||
|
||||
if( marker->GetErrorLevel() == MARKER_BASE::MARKER_SEVERITY_ERROR )
|
||||
err_count++;
|
||||
|
||||
if( marker->GetErrorLevel() == MARKER_BASE::MARKER_SEVERITY_WARNING )
|
||||
warn_count++;
|
||||
|
||||
msg << marker->GetReporter().ShowReport( aUnits );
|
||||
}
|
||||
}
|
||||
|
||||
msg << wxString::Format( _( "\n ** ERC messages: %d Errors %d Warnings %d\n" ),
|
||||
total_count, err_count, warn_count );
|
||||
|
||||
// Currently: write report using UTF8 (as usual in Kicad).
|
||||
// TODO: see if we can use the current encoding page (mainly for Windows users),
|
||||
// Or other format (HTML?)
|
||||
file.Write( msg );
|
||||
|
||||
// wxFFile dtor will close the file.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void NETLIST_OBJECT_LIST::TestforNonOrphanLabel( unsigned aNetItemRef, unsigned aStartNet )
|
||||
{
|
||||
unsigned netItemTst = aStartNet;
|
||||
int erc = 1;
|
||||
|
||||
// Review the list of labels connected to NetItemRef:
|
||||
for( ; ; netItemTst++ )
|
||||
{
|
||||
if( netItemTst == aNetItemRef )
|
||||
continue;
|
||||
|
||||
/* Is always in the same net? */
|
||||
if( ( netItemTst == size() )
|
||||
|| ( GetItemNet( aNetItemRef ) != GetItemNet( netItemTst ) ) )
|
||||
{
|
||||
/* End Netcode found. */
|
||||
if( erc )
|
||||
{
|
||||
/* Glabel or SheetLabel orphaned. */
|
||||
Diagnose( GetItem( aNetItemRef ), NULL, -1, WAR );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if( GetItem( aNetItemRef )->IsLabelConnected( GetItem( netItemTst ) ) )
|
||||
erc = 0;
|
||||
|
||||
//same thing, different order.
|
||||
if( GetItem( netItemTst )->IsLabelConnected( GetItem( aNetItemRef ) ) )
|
||||
erc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// this code try to detect similar labels, i.e. labels which are identical
|
||||
// when they are compared using case insensitive coparisons.
|
||||
|
||||
|
@ -744,20 +580,18 @@ void NETLIST_OBJECT_LIST::TestforSimilarLabels()
|
|||
// Build paths list
|
||||
std::set<NETLIST_OBJECT*, compare_paths> pathsList;
|
||||
|
||||
for( auto it = uniqueLabelList.begin(); it != uniqueLabelList.end(); ++it )
|
||||
pathsList.insert( *it );
|
||||
for( NETLIST_OBJECT* label : uniqueLabelList )
|
||||
pathsList.insert( label );
|
||||
|
||||
// Examine each label inside a sheet path:
|
||||
for( auto it = pathsList.begin(); it != pathsList.end(); ++it )
|
||||
for( NETLIST_OBJECT* candidate : pathsList )
|
||||
{
|
||||
loc_labelList.clear();
|
||||
|
||||
auto it_uniq = uniqueLabelList.begin();
|
||||
|
||||
for( ; it_uniq != uniqueLabelList.end(); ++it_uniq )
|
||||
for( NETLIST_OBJECT* uniqueLabel : uniqueLabelList)
|
||||
{
|
||||
if(( *it )->m_SheetPath.Path() == ( *it_uniq )->m_SheetPath.Path() )
|
||||
loc_labelList.insert( *it_uniq );
|
||||
if( candidate->m_SheetPath.Path() == uniqueLabel->m_SheetPath.Path() )
|
||||
loc_labelList.insert( uniqueLabel );
|
||||
}
|
||||
|
||||
// at this point, loc_labelList contains labels of the current sheet path.
|
||||
|
@ -791,6 +625,7 @@ void NETLIST_OBJECT_LIST::TestforSimilarLabels()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Helper function: count the number of labels identical to aLabel
|
||||
// for global label: global labels in the full project
|
||||
// for local label: all labels in the current sheet
|
||||
|
@ -818,27 +653,13 @@ static int countIndenticalLabels( std::vector<NETLIST_OBJECT*>& aList, NETLIST_O
|
|||
return count;
|
||||
}
|
||||
|
||||
|
||||
// Helper function: creates a marker for similar labels ERC warning
|
||||
static void SimilarLabelsDiagnose( NETLIST_OBJECT* aItemA, NETLIST_OBJECT* aItemB )
|
||||
{
|
||||
// Create new marker for ERC.
|
||||
SCH_MARKER* marker = new SCH_MARKER();
|
||||
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_WARNING );
|
||||
SCH_SCREEN* screen = aItemA->m_SheetPath.LastScreen();
|
||||
screen->Append( marker );
|
||||
|
||||
wxString fmt = aItemA->IsLabelGlobal() ? _( "Global label '%s' (sheet '%s') looks like:" ) :
|
||||
_( "Local label '%s' (sheet '%s') looks like:" );
|
||||
wxString msg;
|
||||
|
||||
msg.Printf( fmt, aItemA->m_Label, aItemA->m_SheetPath.PathHumanReadable() );
|
||||
marker->SetData( aItemA->IsLabelGlobal() && aItemB->IsLabelGlobal() ?
|
||||
ERCE_SIMILAR_GLBL_LABELS : ERCE_SIMILAR_LABELS,
|
||||
aItemA->m_Start, msg, aItemA->m_Start );
|
||||
|
||||
fmt = aItemB->IsLabelGlobal() ? _( "Global label \"%s\" (sheet \"%s\")" ) :
|
||||
_( "Local label \"%s\" (sheet \"%s\")" );
|
||||
msg.Printf( fmt, aItemB->m_Label, aItemB->m_SheetPath.PathHumanReadable() );
|
||||
marker->SetAuxiliaryData( msg, aItemB->m_Start );
|
||||
SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( EDA_UNITS::UNSCALED, ERCE_SIMILAR_LABELS, aItemA->m_Start,
|
||||
aItemA->m_Comp, aItemB->m_Comp );
|
||||
aItemA->m_SheetPath.LastScreen()->Append( marker );
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2009-2015 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2009-2020 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -63,7 +63,6 @@ enum ERCE_T
|
|||
ERCE_NOCONNECT_NOT_CONNECTED, // a no connect symbol is not connected to anything
|
||||
ERCE_LABEL_NOT_CONNECTED, // label not connected to anything
|
||||
ERCE_SIMILAR_LABELS, // 2 labels are equal fir case insensitive comparisons
|
||||
ERCE_SIMILAR_GLBL_LABELS, // 2 labels are equal fir case insensitive comparisons
|
||||
ERCE_DIFFERENT_UNIT_FP, // different units of the same component have different footprints assigned
|
||||
ERCE_DIFFERENT_UNIT_NET, // a shared pin in a multi-unit component is connected to more than one net
|
||||
ERCE_BUS_ALIAS_CONFLICT, // conflicting bus alias definitions across sheets
|
||||
|
@ -84,21 +83,13 @@ enum ERCE_T
|
|||
#define NOC 0 // initial state of a net: no connection
|
||||
|
||||
|
||||
/**
|
||||
* Function WriteDiagnosticERC
|
||||
* save the ERC errors to \a aFullFileName.
|
||||
*
|
||||
* @param aFullFileName A wxString object containing the file name and path.
|
||||
*/
|
||||
bool WriteDiagnosticERC( EDA_UNITS aUnits, const wxString& aFullFileName );
|
||||
|
||||
/**
|
||||
* Performs ERC testing and creates an ERC marker to show the ERC problem for aNetItemRef
|
||||
* or between aNetItemRef and aNetItemTst.
|
||||
* if MinConn < 0: this is an error on labels
|
||||
*/
|
||||
void Diagnose( NETLIST_OBJECT* NetItemRef, NETLIST_OBJECT* NetItemTst,
|
||||
int MinConnexion, int Diag );
|
||||
void Diagnose( NETLIST_OBJECT* NetItemRef, NETLIST_OBJECT* NetItemTst, int MinConnexion,
|
||||
int Diag );
|
||||
|
||||
/**
|
||||
* Perform ERC testing for electrical conflicts between \a NetItemRef and other items
|
||||
|
@ -109,9 +100,8 @@ void Diagnose( NETLIST_OBJECT* NetItemRef, NETLIST_OBJECT* NetItemTst,
|
|||
* @param aMinConnexion = a pointer to a variable to store the minimal connection
|
||||
* found( NOD, DRV, NPI, NET_NC)
|
||||
*/
|
||||
void TestOthersItems( NETLIST_OBJECT_LIST* aList,
|
||||
unsigned aNetItemRef, unsigned aNetStart,
|
||||
int* aMinConnexion );
|
||||
void TestOthersItems( NETLIST_OBJECT_LIST* aList, unsigned aNetItemRef, unsigned aNetStart,
|
||||
int* aMinConnexion );
|
||||
|
||||
/**
|
||||
* Function TestDuplicateSheetNames( )
|
||||
|
@ -129,11 +119,9 @@ int TestDuplicateSheetNames( bool aCreateMarker );
|
|||
* (for example, two hierarchical sub-sheets contain different definitions for
|
||||
* the same bus alias)
|
||||
*
|
||||
* @param aCreateMarker: true = create error markers in schematic,
|
||||
* false = calculate error count only
|
||||
* @return the error count
|
||||
*/
|
||||
int TestConflictingBusAliases( bool aCreateMarker = true );
|
||||
int TestConflictingBusAliases();
|
||||
|
||||
/**
|
||||
* Test if all units of each multiunit component have the same footprint assigned.
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
#include "wx/html/m_templ.h"
|
||||
#include "wx/html/styleparams.h"
|
||||
#include <erc.h>
|
||||
#include <erc_item.h>
|
||||
|
||||
|
||||
wxString ERC_ITEM::GetErrorText() const
|
||||
{
|
||||
switch( m_ErrorCode )
|
||||
{
|
||||
case ERCE_UNSPECIFIED:
|
||||
return wxString( _("ERC err unspecified") );
|
||||
case ERCE_DUPLICATE_SHEET_NAME:
|
||||
return wxString( _("Duplicate sheet names within a given sheet") );
|
||||
case ERCE_PIN_NOT_CONNECTED:
|
||||
return wxString( _("Pin not connected") );
|
||||
case ERCE_PIN_NOT_DRIVEN:
|
||||
return wxString( _( "Pin connected to other pins, but not driven by any pin" ) );
|
||||
case ERCE_PIN_TO_PIN_WARNING:
|
||||
return wxString( _("Conflict problem between pins. Severity: warning") );
|
||||
case ERCE_PIN_TO_PIN_ERROR:
|
||||
return wxString( _("Conflict problem between pins. Severity: error") );
|
||||
case ERCE_HIERACHICAL_LABEL:
|
||||
return wxString( _("Mismatch between hierarchical labels and pins sheets") );
|
||||
case ERCE_NOCONNECT_CONNECTED:
|
||||
return wxString( _("A pin with a \"no connection\" flag is connected") );
|
||||
case ERCE_NOCONNECT_NOT_CONNECTED:
|
||||
return wxString( _("Unconnected \"no connection\" flag") );
|
||||
case ERCE_LABEL_NOT_CONNECTED:
|
||||
return wxString( _("Label not connected anywhere else in the schematic") );
|
||||
case ERCE_SIMILAR_LABELS:
|
||||
return wxString( _("Labels are similar (lower/upper case difference only)" ) );
|
||||
case ERCE_DIFFERENT_UNIT_FP:
|
||||
return wxString( _("Different footprint assigned in another unit of the same component" ) );
|
||||
case ERCE_DIFFERENT_UNIT_NET:
|
||||
return wxString( _("Different net assigned to a shared pin in another unit of the same component" ) );
|
||||
case ERCE_BUS_ALIAS_CONFLICT:
|
||||
return wxString( _("Conflict between bus alias definitions across schematic sheets") );
|
||||
case ERCE_DRIVER_CONFLICT:
|
||||
return wxString( _( "More than one name given to this bus or net" ) );
|
||||
case ERCE_BUS_ENTRY_CONFLICT:
|
||||
return wxString( _( "Net is graphically connected to a bus but not a bus member" ) );
|
||||
case ERCE_BUS_LABEL_ERROR:
|
||||
return wxString( _( "Label attached to bus item does not describe a bus" ) );
|
||||
case ERCE_BUS_TO_BUS_CONFLICT:
|
||||
return wxString( _( "Busses are graphically connected but share no bus members" ) );
|
||||
case ERCE_BUS_TO_NET_CONFLICT:
|
||||
return wxString( _( "Invalid connection between bus and net items" ) );
|
||||
case ERCE_GLOBLABEL:
|
||||
return wxString( _( "Global label not connected anywhere else in the schematic" ) );
|
||||
default:
|
||||
wxFAIL_MSG( "Missing ERC error description" );
|
||||
return wxString( wxT("Unknown.") );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef ERC_ITEM_H
|
||||
#define ERC_ITEM_H
|
||||
|
||||
#include <macros.h>
|
||||
#include <base_struct.h>
|
||||
#include <rc_item.h>
|
||||
#include <marker_base.h>
|
||||
#include <sch_marker.h>
|
||||
#include <sch_screen.h>
|
||||
#include <sch_sheet_path.h>
|
||||
#include "erc_settings.h"
|
||||
|
||||
|
||||
class ERC_ITEM : public RC_ITEM
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Function GetErrorText
|
||||
* returns the string form of a drc error code.
|
||||
*/
|
||||
wxString GetErrorText() const override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* SHEETLIST_ERC_ITEMS_PROVIDER
|
||||
* is an implementation of the RC_ITEM_LISTinterface which uses the global SHEETLIST
|
||||
* to fulfill the contract.
|
||||
*/
|
||||
class SHEETLIST_ERC_ITEMS_PROVIDER : public RC_ITEMS_PROVIDER
|
||||
{
|
||||
private:
|
||||
int m_severities;
|
||||
std::vector<SCH_MARKER*> m_filteredMarkers;
|
||||
|
||||
public:
|
||||
SHEETLIST_ERC_ITEMS_PROVIDER() :
|
||||
m_severities( 0 )
|
||||
{ }
|
||||
|
||||
void SetSeverities( int aSeverities ) override
|
||||
{
|
||||
m_severities = aSeverities;
|
||||
|
||||
m_filteredMarkers.clear();
|
||||
|
||||
SCH_SHEET_LIST sheetList( g_RootSheet);
|
||||
|
||||
for( unsigned i = 0; i < sheetList.size(); i++ )
|
||||
{
|
||||
for( SCH_ITEM* aItem : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
|
||||
{
|
||||
SCH_MARKER* marker = static_cast<SCH_MARKER*>( aItem );
|
||||
int markerSeverity;
|
||||
|
||||
if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
|
||||
continue;
|
||||
|
||||
if( marker->IsExcluded() )
|
||||
markerSeverity = RPT_SEVERITY_EXCLUSION;
|
||||
else
|
||||
markerSeverity = GetSeverity( marker->GetRCItem()->GetErrorCode() );
|
||||
|
||||
if( markerSeverity & m_severities )
|
||||
m_filteredMarkers.push_back( marker );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int GetCount( int aSeverity = -1 ) override
|
||||
{
|
||||
if( aSeverity < 0 )
|
||||
return m_filteredMarkers.size();
|
||||
|
||||
int count = 0;
|
||||
|
||||
SCH_SHEET_LIST sheetList( g_RootSheet);
|
||||
|
||||
for( unsigned i = 0; i < sheetList.size(); i++ )
|
||||
{
|
||||
for( SCH_ITEM* aItem : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
|
||||
{
|
||||
SCH_MARKER* marker = static_cast<SCH_MARKER*>( aItem );
|
||||
int markerSeverity;
|
||||
|
||||
if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
|
||||
continue;
|
||||
|
||||
if( marker->IsExcluded() )
|
||||
markerSeverity = RPT_SEVERITY_EXCLUSION;
|
||||
else
|
||||
markerSeverity = GetSeverity( marker->GetRCItem()->GetErrorCode() );
|
||||
|
||||
if( markerSeverity == aSeverity )
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
ERC_ITEM* GetItem( int aIndex ) override
|
||||
{
|
||||
SCH_MARKER* marker = m_filteredMarkers[ aIndex ];
|
||||
|
||||
return marker ? static_cast<ERC_ITEM*>( marker->GetRCItem() ) : nullptr;
|
||||
}
|
||||
|
||||
void DeleteItem( int aIndex, bool aDeep ) override
|
||||
{
|
||||
SCH_MARKER* marker = m_filteredMarkers[ aIndex ];
|
||||
m_filteredMarkers.erase( m_filteredMarkers.begin() + aIndex );
|
||||
|
||||
if( aDeep )
|
||||
{
|
||||
SCH_SCREENS ScreenList;
|
||||
ScreenList.DeleteMarker( marker );
|
||||
}
|
||||
}
|
||||
|
||||
void DeleteAllItems() override
|
||||
{
|
||||
SCH_SCREENS ScreenList;
|
||||
ScreenList.DeleteAllMarkers( MARKER_BASE::MARKER_ERC );
|
||||
m_filteredMarkers.clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif // ERC_ITEM_H
|
|
@ -47,7 +47,6 @@ public:
|
|||
|
||||
void LoadDefaults()
|
||||
{
|
||||
m_Severities[ ERCE_SIMILAR_GLBL_LABELS ] = RPT_SEVERITY_WARNING;
|
||||
m_Severities[ ERCE_SIMILAR_LABELS ] = RPT_SEVERITY_WARNING;
|
||||
m_Severities[ ERCE_GLOBLABEL ] = RPT_SEVERITY_WARNING;
|
||||
m_Severities[ ERCE_DRIVER_CONFLICT ] = RPT_SEVERITY_WARNING;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2016 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
* Copyright (C) 2016-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -22,15 +22,12 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file general.h
|
||||
*/
|
||||
|
||||
#ifndef _GENERAL_H_
|
||||
#define _GENERAL_H_
|
||||
|
||||
#include <gal/color4d.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
#include <erc_settings.h>
|
||||
|
||||
using KIGFX::COLOR4D;
|
||||
|
||||
|
@ -38,6 +35,7 @@ class CONNECTION_GRAPH;
|
|||
class TRANSFORM;
|
||||
class SCH_SHEET;
|
||||
class SCH_SHEET_PATH;
|
||||
class ERC_SETTINGS;
|
||||
|
||||
#define EESCHEMA_VERSION 5
|
||||
#define SCHEMATIC_HEAD_STRING "Schematic File Version"
|
||||
|
@ -47,7 +45,6 @@ class SCH_SHEET_PATH;
|
|||
|
||||
#define DEFAULT_REPEAT_OFFSET_X 0 ///< the default X value (overwritten by the eeschema config)
|
||||
#define DEFAULT_REPEAT_OFFSET_Y 100 ///< the default Y value (overwritten by the eeschema config)
|
||||
#define REPEAT_OFFSET_MAX 1000 ///< the max value of repeat offset value
|
||||
#define DEFAULT_REPEAT_LABEL_INC 1 ///< the default value (overwritten by the eeschema config)
|
||||
#define DEFAULT_REPEAT_OFFSET_PIN 100 ///< the default value (overwritten by the eeschema config)
|
||||
///< when repeating a pin
|
||||
|
@ -69,9 +66,6 @@ class SCH_SHEET_PATH;
|
|||
///< The default pin name size when creating pins(can be changed in preference menu)
|
||||
#define DEFAULTPINNAMESIZE 50
|
||||
|
||||
///< The default library pane width
|
||||
#define DEFAULTLIBWIDTH 250
|
||||
|
||||
///< The default selection highlight thickness
|
||||
#define DEFAULTSELECTIONTHICKNESS 3
|
||||
|
||||
|
@ -98,6 +92,14 @@ extern SCH_SHEET_PATH* g_CurrentSheet; ///< which sheet we are presently work
|
|||
*/
|
||||
extern CONNECTION_GRAPH* g_ConnectionGraph;
|
||||
|
||||
/**
|
||||
* This also wants to live in the eventual SCHEMATIC object
|
||||
*/
|
||||
extern ERC_SETTINGS* g_ErcSettings;
|
||||
|
||||
int GetSeverity( int aErrorCode );
|
||||
void SetSeverity( int aErrorCode, int aSeverity );
|
||||
|
||||
/**
|
||||
* Default line thickness used to draw/plot items having a
|
||||
* default thickness line value (i.e. = 0 ).
|
||||
|
|
|
@ -392,24 +392,6 @@ public:
|
|||
*/
|
||||
void SortListbySheet();
|
||||
|
||||
/**
|
||||
* Counts number of pins connected on the same net.
|
||||
* Used to count all pins connected to a no connect symbol
|
||||
* @return the pin count of the net starting at aNetStart
|
||||
* @param aNetStart = index in list of net objects of the first item
|
||||
*/
|
||||
int CountPinsInNet( unsigned aNetStart );
|
||||
|
||||
/**
|
||||
* Function TestforNonOrphanLabel
|
||||
* Sheet labels are expected to be connected to a hierarchical label.
|
||||
* Hierarchical labels are expected to be connected to a sheet label.
|
||||
* Global labels are expected to be not orphan (connected to at least one
|
||||
* other global label.
|
||||
* This function tests the connection to another suitable label.
|
||||
*/
|
||||
void TestforNonOrphanLabel( unsigned aNetItemRef, unsigned aStartNet );
|
||||
|
||||
/**
|
||||
* Function TestforSimilarLabels
|
||||
* detects labels which are different when using case sensitive comparisons
|
||||
|
|
|
@ -315,6 +315,42 @@ void SCH_BASE_FRAME::CenterScreen( const wxPoint& aCenterPoint, bool aWarpPointe
|
|||
}
|
||||
|
||||
|
||||
void SCH_BASE_FRAME::FocusOnItem( SCH_ITEM* aItem )
|
||||
{
|
||||
static KIID lastBrightenedItemID( niluuid );
|
||||
|
||||
SCH_SHEET_LIST sheetList( g_RootSheet );
|
||||
SCH_SHEET_PATH dummy;
|
||||
SCH_ITEM* lastItem = sheetList.GetItem( lastBrightenedItemID, &dummy );
|
||||
|
||||
if( lastItem && lastItem != aItem )
|
||||
{
|
||||
lastItem->ClearBrightened();
|
||||
|
||||
RefreshItem( lastItem );
|
||||
lastBrightenedItemID = niluuid;
|
||||
}
|
||||
|
||||
if( aItem )
|
||||
{
|
||||
aItem->SetBrightened();
|
||||
|
||||
RefreshItem( aItem );
|
||||
lastBrightenedItemID = aItem->m_Uuid;
|
||||
|
||||
wxPoint position = aItem->GetPosition();
|
||||
|
||||
if( aItem->GetParent() && aItem->GetParent()->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
SCH_COMPONENT* comp = static_cast<SCH_COMPONENT*>( aItem->GetParent() );
|
||||
position += comp->GetPosition();
|
||||
}
|
||||
|
||||
FocusOnLocation( position );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_BASE_FRAME::HardRedraw()
|
||||
{
|
||||
GetCanvas()->GetView()->UpdateAllItems( KIGFX::ALL );
|
||||
|
|
|
@ -312,6 +312,8 @@ public:
|
|||
|
||||
virtual void CenterScreen( const wxPoint& aCenterPoint, bool aWarpPointer );
|
||||
|
||||
void FocusOnItem( SCH_ITEM* aItem );
|
||||
|
||||
void HardRedraw() override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -573,27 +573,37 @@ void SCH_COMPONENT::AddHierarchicalReference( const KIID_PATH& aPath, const wxSt
|
|||
}
|
||||
|
||||
|
||||
const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet )
|
||||
const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet, bool aIncludeUnit )
|
||||
{
|
||||
KIID_PATH path = sheet->Path();
|
||||
wxString ref;
|
||||
|
||||
for( const COMPONENT_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
{
|
||||
if( instance.m_Path == path )
|
||||
return instance.m_Reference;
|
||||
{
|
||||
ref = instance.m_Reference;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If it was not found in m_Paths array, then see if it is in m_Field[REFERENCE] -- if so,
|
||||
// use this as a default for this path. This will happen if we load a version 1 schematic
|
||||
// file. It will also mean that multiple instances of the same sheet by default all have
|
||||
// the same component references, but perhaps this is best.
|
||||
if( !GetField( REFERENCE )->GetText().IsEmpty() )
|
||||
if( ref.IsEmpty() && !GetField( REFERENCE )->GetText().IsEmpty() )
|
||||
{
|
||||
SetRef( sheet, GetField( REFERENCE )->GetText() );
|
||||
return GetField( REFERENCE )->GetText();
|
||||
ref = GetField( REFERENCE )->GetText();
|
||||
}
|
||||
|
||||
return m_prefix;
|
||||
if( ref.IsEmpty() )
|
||||
ref = m_prefix;
|
||||
|
||||
if( aIncludeUnit )
|
||||
ref += LIB_PART::SubReference( GetUnit() );
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1594,9 +1604,9 @@ void SCH_COMPONENT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
|
|||
|
||||
NETLIST_OBJECT* item = new NETLIST_OBJECT();
|
||||
item->m_SheetPathInclude = *aSheetPath;
|
||||
item->m_Comp = (SCH_ITEM*) pin;
|
||||
item->m_SheetPath = *aSheetPath;
|
||||
item->m_Type = NETLIST_ITEM::PIN;
|
||||
item->m_Comp = m_pins[ m_pinMap.at( pin ) ].get();
|
||||
item->m_SheetPath = *aSheetPath;
|
||||
item->m_Type = NETLIST_ITEM::PIN;
|
||||
item->m_Link = (SCH_ITEM*) this;
|
||||
item->m_ElectricalPinType = pin->GetType();
|
||||
item->m_PinNum = pin->GetNumber();
|
||||
|
@ -1611,8 +1621,8 @@ void SCH_COMPONENT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
|
|||
item = new NETLIST_OBJECT();
|
||||
item->m_SheetPathInclude = *aSheetPath;
|
||||
item->m_Comp = NULL;
|
||||
item->m_SheetPath = *aSheetPath;
|
||||
item->m_Type = NETLIST_ITEM::PINLABEL;
|
||||
item->m_SheetPath = *aSheetPath;
|
||||
item->m_Type = NETLIST_ITEM::PINLABEL;
|
||||
item->m_Label = pin->GetName();
|
||||
item->m_Start = pos;
|
||||
item->m_End = item->m_Start;
|
||||
|
|
|
@ -488,7 +488,7 @@ public:
|
|||
*
|
||||
* @return the reference for the sheet.
|
||||
*/
|
||||
const wxString GetRef( const SCH_SHEET_PATH* aSheet );
|
||||
const wxString GetRef( const SCH_SHEET_PATH* aSheet, bool aIncludeUnit = false );
|
||||
|
||||
/**
|
||||
* Set the reference for the given sheet path for this symbol.
|
||||
|
|
|
@ -2042,9 +2042,8 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
}
|
||||
else
|
||||
{
|
||||
SCH_MARKER* marker =
|
||||
new SCH_MARKER( linestart, "Bus Entry needed" );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( 0, linestart, "Bus Entry needed" );
|
||||
m_currentSheet->GetScreen()->Append( marker );
|
||||
}
|
||||
}
|
||||
|
@ -2079,9 +2078,8 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
}
|
||||
else
|
||||
{
|
||||
SCH_MARKER* marker =
|
||||
new SCH_MARKER( linestart, "Bus Entry needed" );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( 0, linestart, "Bus Entry needed" );
|
||||
m_currentSheet->GetScreen()->Append( marker );
|
||||
}
|
||||
}
|
||||
|
@ -2120,8 +2118,8 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
}
|
||||
else
|
||||
{
|
||||
SCH_MARKER* marker = new SCH_MARKER( lineend, "Bus Entry needed" );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( 0, lineend, "Bus Entry needed" );
|
||||
m_currentSheet->GetScreen()->Append( marker );
|
||||
}
|
||||
}
|
||||
|
@ -2155,8 +2153,8 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
}
|
||||
else
|
||||
{
|
||||
SCH_MARKER* marker = new SCH_MARKER( lineend, "Bus Entry needed" );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( 0, lineend, "Bus Entry needed" );
|
||||
m_currentSheet->GetScreen()->Append( marker );
|
||||
}
|
||||
}
|
||||
|
@ -2195,9 +2193,8 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
}
|
||||
else
|
||||
{
|
||||
SCH_MARKER* marker =
|
||||
new SCH_MARKER( linestart, "Bus Entry needed" );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( 0, linestart, "Bus Entry needed" );
|
||||
m_currentSheet->GetScreen()->Append( marker );
|
||||
}
|
||||
}
|
||||
|
@ -2226,9 +2223,8 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
}
|
||||
else
|
||||
{
|
||||
SCH_MARKER* marker =
|
||||
new SCH_MARKER( linestart, "Bus Entry needed" );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( 0, linestart, "Bus Entry needed" );
|
||||
m_currentSheet->GetScreen()->Append( marker );
|
||||
}
|
||||
}
|
||||
|
@ -2264,8 +2260,8 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
}
|
||||
else
|
||||
{
|
||||
SCH_MARKER* marker = new SCH_MARKER( lineend, "Bus Entry needed" );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( 0, lineend, "Bus Entry needed" );
|
||||
m_currentSheet->GetScreen()->Append( marker );
|
||||
}
|
||||
}
|
||||
|
@ -2294,8 +2290,8 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
|||
}
|
||||
else
|
||||
{
|
||||
SCH_MARKER* marker = new SCH_MARKER( lineend, "Bus Entry needed" );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
|
||||
marker->SetData( 0, lineend, "Bus Entry needed" );
|
||||
m_currentSheet->GetScreen()->Append( marker );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
|
||||
SCH_SHEET_PATH* g_CurrentSheet = nullptr; // declared in general.h
|
||||
CONNECTION_GRAPH* g_ConnectionGraph = nullptr;
|
||||
ERC_SETTINGS* g_ErcSettings = nullptr;
|
||||
|
||||
// non-member so it can be moved easily, and kept REALLY private.
|
||||
// Do NOT Clear() in here.
|
||||
|
@ -213,6 +214,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
|||
{
|
||||
g_CurrentSheet = new SCH_SHEET_PATH();
|
||||
g_ConnectionGraph = new CONNECTION_GRAPH( this );
|
||||
g_ErcSettings = new ERC_SETTINGS();
|
||||
|
||||
m_showBorderAndTitleBlock = true; // true to show sheet references
|
||||
m_showAllPins = false;
|
||||
|
@ -301,10 +303,12 @@ SCH_EDIT_FRAME::~SCH_EDIT_FRAME()
|
|||
delete g_CurrentSheet; // a SCH_SHEET_PATH, on the heap.
|
||||
delete g_ConnectionGraph;
|
||||
delete g_RootSheet;
|
||||
delete g_ErcSettings;
|
||||
|
||||
g_CurrentSheet = nullptr;
|
||||
g_ConnectionGraph = nullptr;
|
||||
g_RootSheet = NULL;
|
||||
g_RootSheet = nullptr;
|
||||
g_ErcSettings = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -448,6 +452,8 @@ void SCH_EDIT_FRAME::SetCurrentSheet( const SCH_SHEET_PATH& aSheet )
|
|||
{
|
||||
if( aSheet != *g_CurrentSheet )
|
||||
{
|
||||
FocusOnItem( nullptr );
|
||||
|
||||
*g_CurrentSheet = aSheet;
|
||||
GetCanvas()->DisplaySheet( g_CurrentSheet->LastScreen() );
|
||||
}
|
||||
|
@ -456,6 +462,8 @@ void SCH_EDIT_FRAME::SetCurrentSheet( const SCH_SHEET_PATH& aSheet )
|
|||
|
||||
void SCH_EDIT_FRAME::HardRedraw()
|
||||
{
|
||||
FocusOnItem( nullptr );
|
||||
|
||||
GetCanvas()->DisplaySheet( g_CurrentSheet->LastScreen() );
|
||||
GetCanvas()->ForceRefresh();
|
||||
}
|
||||
|
|
|
@ -125,7 +125,6 @@ private:
|
|||
|
||||
std::vector<PARAM_CFG*> m_projectFileParams;
|
||||
std::vector<PARAM_CFG*> m_configSettings;
|
||||
ERC_SETTINGS m_ercSettings;
|
||||
wxPageSetupDialogData m_pageSetupData;
|
||||
bool m_printMonochrome; ///< Print monochrome instead of grey scale.
|
||||
bool m_printSheetReference;
|
||||
|
@ -271,8 +270,6 @@ public:
|
|||
void DoShowSchematicSetupDialog( const wxString& aInitialPage = wxEmptyString,
|
||||
const wxString& aInitialParentPage = wxEmptyString );
|
||||
|
||||
ERC_SETTINGS& GetErcSettings() { return m_ercSettings; }
|
||||
|
||||
/**
|
||||
* Insert or append a wanted symbol field name into the field names template.
|
||||
*
|
||||
|
|
|
@ -28,23 +28,20 @@
|
|||
#include <msgpanel.h>
|
||||
#include <bitmaps.h>
|
||||
#include <base_units.h>
|
||||
|
||||
#include <sch_marker.h>
|
||||
#include <widgets/ui_common.h>
|
||||
#include <pgm_base.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <erc_item.h>
|
||||
|
||||
/// Factor to convert the maker unit shape to internal units:
|
||||
#define SCALING_FACTOR Millimeter2iu( 0.1 )
|
||||
|
||||
|
||||
// JEY TODO: retire this; there's no reason not to use the next one...
|
||||
SCH_MARKER::SCH_MARKER() : SCH_ITEM( NULL, SCH_MARKER_T ), MARKER_BASE( SCALING_FACTOR )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// JEY TODO: pass in ERCE code so we can get severity from it...
|
||||
SCH_MARKER::SCH_MARKER( const wxPoint& pos, const wxString& text ) :
|
||||
SCH_ITEM( NULL, SCH_MARKER_T ),
|
||||
MARKER_BASE( 0, pos, text, pos, wxEmptyString, wxPoint(), SCALING_FACTOR )
|
||||
SCH_MARKER::SCH_MARKER( TYPEMARKER aType ) :
|
||||
SCH_ITEM( nullptr, SCH_MARKER_T ),
|
||||
MARKER_BASE( SCALING_FACTOR, new ERC_ITEM(), aType )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -72,14 +69,39 @@ void SCH_MARKER::Show( int nestLevel, std::ostream& os ) const
|
|||
#endif
|
||||
|
||||
|
||||
KIGFX::COLOR4D SCH_MARKER::getColor() const
|
||||
void SCH_MARKER::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
{
|
||||
aCount = 2;
|
||||
|
||||
switch( g_ErcSettings->m_Severities[ m_rcItem->GetErrorCode() ] )
|
||||
{
|
||||
default:
|
||||
case SEVERITY::RPT_SEVERITY_ERROR: aLayers[0] = LAYER_ERC_ERR; break;
|
||||
case SEVERITY::RPT_SEVERITY_WARNING: aLayers[0] = LAYER_ERC_WARN; break;
|
||||
}
|
||||
|
||||
aLayers[1] = LAYER_SELECTION_SHADOWS;
|
||||
}
|
||||
|
||||
|
||||
SCH_LAYER_ID SCH_MARKER::GetColorLayer() const
|
||||
{
|
||||
if( IsExcluded() )
|
||||
return GetLayerColor( LAYER_HIDDEN );
|
||||
else if( GetErrorLevel() == MARKER_BASE::MARKER_SEVERITY_ERROR )
|
||||
return GetLayerColor( LAYER_ERC_ERR );
|
||||
else
|
||||
return GetLayerColor( LAYER_ERC_WARN );
|
||||
return LAYER_HIDDEN;
|
||||
|
||||
switch( g_ErcSettings->m_Severities[ m_rcItem->GetErrorCode() ] )
|
||||
{
|
||||
default:
|
||||
case SEVERITY::RPT_SEVERITY_ERROR: return LAYER_ERC_ERR;
|
||||
case SEVERITY::RPT_SEVERITY_WARNING: return LAYER_ERC_WARN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
KIGFX::COLOR4D SCH_MARKER::getColor() const
|
||||
{
|
||||
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
|
||||
return colors->GetColor( GetColorLayer() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,17 +113,9 @@ void SCH_MARKER::Print( wxDC* aDC, const wxPoint& aOffset )
|
|||
|
||||
bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
|
||||
{
|
||||
return SCH_ITEM::Matches( m_drc.GetErrorText(), aSearchData )
|
||||
|| SCH_ITEM::Matches( m_drc.GetMainText(), aSearchData )
|
||||
|| SCH_ITEM::Matches( m_drc.GetAuxiliaryText(), aSearchData );
|
||||
}
|
||||
|
||||
|
||||
void SCH_MARKER::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
{
|
||||
aCount = 2;
|
||||
aLayers[0] = this->m_ErrorLevel == MARKER_SEVERITY_ERROR ? LAYER_ERC_ERR : LAYER_ERC_WARN;
|
||||
aLayers[1] = LAYER_SELECTION_SHADOWS;
|
||||
return SCH_ITEM::Matches( m_rcItem->GetErrorText(), aSearchData )
|
||||
|| SCH_ITEM::Matches( m_rcItem->GetMainText(), aSearchData )
|
||||
|| SCH_ITEM::Matches( m_rcItem->GetAuxText(), aSearchData );
|
||||
}
|
||||
|
||||
|
||||
|
@ -114,7 +128,7 @@ const EDA_RECT SCH_MARKER::GetBoundingBox() const
|
|||
void SCH_MARKER::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
|
||||
{
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Electronics Rule Check Error" ),
|
||||
GetReporter().GetErrorText(), DARKRED ) );
|
||||
m_rcItem->GetErrorText(), DARKRED ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -32,9 +32,7 @@
|
|||
class SCH_MARKER : public SCH_ITEM, public MARKER_BASE
|
||||
{
|
||||
public:
|
||||
SCH_MARKER();
|
||||
|
||||
SCH_MARKER( const wxPoint& aPos, const wxString& aText );
|
||||
SCH_MARKER( TYPEMARKER aType );
|
||||
|
||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||
|
||||
|
@ -48,10 +46,14 @@ public:
|
|||
return wxT( "SCH_MARKER" );
|
||||
}
|
||||
|
||||
const KIID GetUUID() const override { return m_Uuid; }
|
||||
|
||||
void SwapData( SCH_ITEM* aItem ) override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
SCH_LAYER_ID GetColorLayer() const;
|
||||
|
||||
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) override
|
||||
|
|
|
@ -1689,12 +1689,7 @@ void SCH_PAINTER::draw( SCH_MARKER *aMarker, int aLayer )
|
|||
if( drawingShadows && !aMarker->IsSelected() )
|
||||
return;
|
||||
|
||||
if( aMarker->GetErrorLevel() == MARKER_BASE::MARKER_SEVERITY_ERROR )
|
||||
aLayer = LAYER_ERC_ERR;
|
||||
else
|
||||
aLayer = LAYER_ERC_WARN;
|
||||
|
||||
COLOR4D color = getRenderColor( aMarker, aLayer, drawingShadows );
|
||||
COLOR4D color = getRenderColor( aMarker, aMarker->GetColorLayer(), drawingShadows );
|
||||
|
||||
m_gal->Save();
|
||||
m_gal->Translate( aMarker->GetPosition() );
|
||||
|
|
|
@ -81,6 +81,24 @@ void SCH_PIN::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_PIN::GetDescription( const SCH_SHEET_PATH* aSheet )
|
||||
{
|
||||
if( GetName().IsEmpty() || GetNumber().IsEmpty() )
|
||||
{
|
||||
return wxString::Format( _( "Pin %s of component %s." ),
|
||||
GetName().IsEmpty() ? GetNumber() : GetName(),
|
||||
GetParentComponent()->GetRef( aSheet ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return wxString::Format( _( "Pin %s (%s) of component %s." ),
|
||||
GetName(),
|
||||
GetNumber(),
|
||||
GetParentComponent()->GetRef( aSheet ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxString SCH_PIN::GetDefaultNetName( const SCH_SHEET_PATH aPath )
|
||||
{
|
||||
if( m_libPin->IsPowerConnection() )
|
||||
|
|
|
@ -67,7 +67,8 @@ public:
|
|||
wxString GetDefaultNetName( const SCH_SHEET_PATH aPath );
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
void GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) override;
|
||||
void GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) override;
|
||||
wxString GetDescription( const SCH_SHEET_PATH* aSheet );
|
||||
|
||||
void Print( wxDC* aDC, const wxPoint& aOffset ) override {}
|
||||
|
||||
|
|
|
@ -216,7 +216,8 @@ void SCH_SCREEN::FreeDrawList()
|
|||
std::vector<SCH_ITEM*> delete_list;
|
||||
|
||||
std::copy_if( m_rtree.begin(), m_rtree.end(), std::back_inserter( delete_list ),
|
||||
[]( SCH_ITEM* aItem ) {
|
||||
[]( SCH_ITEM* aItem )
|
||||
{
|
||||
return ( aItem->Type() != SCH_SHEET_PIN_T && aItem->Type() != SCH_FIELD_T );
|
||||
} );
|
||||
|
||||
|
@ -645,13 +646,13 @@ void SCH_SCREEN::ClearDrawingState()
|
|||
}
|
||||
|
||||
|
||||
LIB_PIN* SCH_SCREEN::GetPin(
|
||||
const wxPoint& aPosition, SCH_COMPONENT** aComponent, bool aEndPointOnly )
|
||||
LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponent,
|
||||
bool aEndPointOnly )
|
||||
{
|
||||
SCH_COMPONENT* component = NULL;
|
||||
LIB_PIN* pin = NULL;
|
||||
|
||||
for( auto item : Items().Overlapping( SCH_COMPONENT_T, aPosition ) )
|
||||
for( SCH_ITEM* item : Items().Overlapping( SCH_COMPONENT_T, aPosition ) )
|
||||
{
|
||||
component = static_cast<SCH_COMPONENT*>( item );
|
||||
|
||||
|
@ -700,7 +701,7 @@ SCH_SHEET_PIN* SCH_SCREEN::GetSheetLabel( const wxPoint& aPosition )
|
|||
{
|
||||
SCH_SHEET_PIN* sheetPin = nullptr;
|
||||
|
||||
for( auto item : Items().OfType( SCH_SHEET_T ) )
|
||||
for( SCH_ITEM* item : Items().OfType( SCH_SHEET_T ) )
|
||||
{
|
||||
auto sheet = static_cast<SCH_SHEET*>( item );
|
||||
|
||||
|
@ -718,7 +719,7 @@ size_t SCH_SCREEN::CountConnectedItems( const wxPoint& aPos, bool aTestJunctions
|
|||
{
|
||||
size_t count = 0;
|
||||
|
||||
for( auto item : Items() )
|
||||
for( SCH_ITEM* item : Items() )
|
||||
{
|
||||
if( ( item->Type() != SCH_JUNCTION_T || aTestJunctions ) && item->IsConnected( aPos ) )
|
||||
count++;
|
||||
|
@ -731,9 +732,9 @@ size_t SCH_SCREEN::CountConnectedItems( const wxPoint& aPos, bool aTestJunctions
|
|||
void SCH_SCREEN::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
|
||||
{
|
||||
|
||||
for( auto item : Items().OfType( SCH_COMPONENT_T ) )
|
||||
for( SCH_ITEM* item : Items().OfType( SCH_COMPONENT_T ) )
|
||||
{
|
||||
auto component = static_cast<SCH_COMPONENT*>( item );
|
||||
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
|
||||
|
||||
component->ClearAnnotation( aSheetPath );
|
||||
|
||||
|
@ -750,7 +751,7 @@ void SCH_SCREEN::EnsureAlternateReferencesExist()
|
|||
if( GetClientSheetPathsCount() <= 1 ) // No need for alternate reference
|
||||
return;
|
||||
|
||||
for( auto item : Items().OfType( SCH_COMPONENT_T ) )
|
||||
for( SCH_ITEM* item : Items().OfType( SCH_COMPONENT_T ) )
|
||||
{
|
||||
auto component = static_cast<SCH_COMPONENT*>( item );
|
||||
|
||||
|
@ -763,7 +764,7 @@ void SCH_SCREEN::EnsureAlternateReferencesExist()
|
|||
|
||||
void SCH_SCREEN::GetHierarchicalItems( EDA_ITEMS& aItems )
|
||||
{
|
||||
for( auto item : Items() )
|
||||
for( SCH_ITEM* item : Items() )
|
||||
{
|
||||
if( ( item->Type() == SCH_SHEET_T ) || ( item->Type() == SCH_COMPONENT_T ) )
|
||||
aItems.push_back( item );
|
||||
|
@ -776,10 +777,10 @@ bool SCH_SCREEN::TestDanglingEnds( const SCH_SHEET_PATH* aPath )
|
|||
std::vector< DANGLING_END_ITEM > endPoints;
|
||||
bool hasStateChanged = false;
|
||||
|
||||
for( auto item : Items() )
|
||||
for( SCH_ITEM* item : Items() )
|
||||
item->GetEndPoints( endPoints );
|
||||
|
||||
for( auto item : Items() )
|
||||
for( SCH_ITEM* item : Items() )
|
||||
{
|
||||
if( item->UpdateDanglingState( endPoints, aPath ) )
|
||||
hasStateChanged = true;
|
||||
|
@ -792,7 +793,7 @@ bool SCH_SCREEN::TestDanglingEnds( const SCH_SHEET_PATH* aPath )
|
|||
SCH_LINE* SCH_SCREEN::GetLine( const wxPoint& aPosition, int aAccuracy, int aLayer,
|
||||
SCH_LINE_TEST_T aSearchType )
|
||||
{
|
||||
for( auto item : Items() )
|
||||
for( SCH_ITEM* item : Items() )
|
||||
{
|
||||
if( item->Type() != SCH_LINE_T )
|
||||
continue;
|
||||
|
@ -825,7 +826,7 @@ SCH_LINE* SCH_SCREEN::GetLine( const wxPoint& aPosition, int aAccuracy, int aLay
|
|||
|
||||
SCH_TEXT* SCH_SCREEN::GetLabel( const wxPoint& aPosition, int aAccuracy )
|
||||
{
|
||||
for( auto item : Items().Overlapping( aPosition, aAccuracy ) )
|
||||
for( SCH_ITEM* item : Items().Overlapping( aPosition, aAccuracy ) )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
|
@ -850,7 +851,7 @@ bool SCH_SCREEN::SetComponentFootprint( SCH_SHEET_PATH* aSheetPath, const wxStri
|
|||
SCH_COMPONENT* component;
|
||||
bool found = false;
|
||||
|
||||
for( auto item : Items().OfType( SCH_COMPONENT_T ) )
|
||||
for( SCH_ITEM* item : Items().OfType( SCH_COMPONENT_T ) )
|
||||
{
|
||||
component = static_cast<SCH_COMPONENT*>( item );
|
||||
|
||||
|
@ -934,10 +935,9 @@ void SCH_SCREEN::Show( int nestLevel, std::ostream& os ) const
|
|||
{
|
||||
// for now, make it look like XML, expand on this later.
|
||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
|
||||
for( const auto item : Items() )
|
||||
{
|
||||
|
||||
for( const SCH_ITEM* item : Items() )
|
||||
item->Show( nestLevel + 1, os );
|
||||
}
|
||||
|
||||
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
|
||||
}
|
||||
|
@ -990,9 +990,9 @@ void SCH_SCREENS::addScreenToList( SCH_SCREEN* aScreen )
|
|||
if( aScreen == NULL )
|
||||
return;
|
||||
|
||||
for( unsigned int i = 0; i < m_screens.size(); i++ )
|
||||
for( const SCH_SCREEN* screen : m_screens )
|
||||
{
|
||||
if( m_screens[i] == aScreen )
|
||||
if( screen == aScreen )
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1008,7 +1008,7 @@ void SCH_SCREENS::buildScreenList( SCH_SHEET* aSheet )
|
|||
|
||||
addScreenToList( screen );
|
||||
|
||||
for( auto item : screen->Items().OfType( SCH_SHEET_T ) )
|
||||
for( SCH_ITEM* item : screen->Items().OfType( SCH_SHEET_T ) )
|
||||
buildScreenList( static_cast<SCH_SHEET*>( item ) );
|
||||
}
|
||||
}
|
||||
|
@ -1016,8 +1016,8 @@ void SCH_SCREENS::buildScreenList( SCH_SHEET* aSheet )
|
|||
|
||||
void SCH_SCREENS::ClearAnnotation()
|
||||
{
|
||||
for( size_t i = 0; i < m_screens.size(); i++ )
|
||||
m_screens[i]->ClearAnnotation( NULL );
|
||||
for( SCH_SCREEN* screen : m_screens )
|
||||
screen->ClearAnnotation( NULL );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1095,49 +1095,49 @@ int SCH_SCREENS::ReplaceDuplicateTimeStamps()
|
|||
}
|
||||
|
||||
|
||||
void SCH_SCREENS::DeleteAllMarkers( enum MARKER_BASE::TYPEMARKER aMarkerType )
|
||||
void SCH_SCREENS::DeleteMarker( SCH_MARKER* aMarker )
|
||||
{
|
||||
for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
|
||||
{
|
||||
std::vector<SCH_ITEM*> markers;
|
||||
|
||||
for( auto item : screen->Items().OfType( SCH_MARKER_T ) )
|
||||
for( SCH_ITEM* item : screen->Items().OfType( SCH_MARKER_T ) )
|
||||
{
|
||||
if( static_cast<SCH_MARKER*>( item )->GetMarkerType() == aMarkerType )
|
||||
markers.push_back( item );
|
||||
}
|
||||
|
||||
for( auto marker : markers )
|
||||
{
|
||||
screen->Remove( marker );
|
||||
delete marker;
|
||||
if( item == aMarker )
|
||||
{
|
||||
screen->DeleteItem( item );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int SCH_SCREENS::GetMarkerCount( enum MARKER_BASE::TYPEMARKER aMarkerType,
|
||||
enum MARKER_BASE::MARKER_SEVERITY aSeverity )
|
||||
void SCH_SCREENS::DeleteMarkers( enum MARKER_BASE::TYPEMARKER aMarkerType, int aErrorCode )
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
|
||||
{
|
||||
for( auto item : screen->Items().OfType( SCH_MARKER_T ) )
|
||||
std::vector<SCH_ITEM*> markers;
|
||||
|
||||
for( SCH_ITEM* item : screen->Items().OfType( SCH_MARKER_T ) )
|
||||
{
|
||||
auto marker = static_cast<SCH_MARKER*>( item );
|
||||
SCH_MARKER* marker = static_cast<SCH_MARKER*>( item );
|
||||
RC_ITEM* rcItem = marker->GetRCItem();
|
||||
|
||||
if( ( aMarkerType != MARKER_BASE::MARKER_UNSPEC ) &&
|
||||
( marker->GetMarkerType() != aMarkerType ) )
|
||||
continue;
|
||||
|
||||
if( aSeverity == MARKER_BASE::MARKER_SEVERITY_UNSPEC ||
|
||||
aSeverity == marker->GetErrorLevel() )
|
||||
count++;
|
||||
if( marker->GetMarkerType() == aMarkerType &&
|
||||
( aErrorCode == ERCE_UNSPECIFIED || rcItem->GetErrorCode() == aErrorCode ) )
|
||||
{
|
||||
markers.push_back( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
for( SCH_ITEM* marker : markers )
|
||||
screen->DeleteItem( marker );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_SCREENS::DeleteAllMarkers( enum MARKER_BASE::TYPEMARKER aMarkerType )
|
||||
{
|
||||
DeleteMarkers( aMarkerType, ERCE_UNSPECIFIED );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -534,16 +534,14 @@ public:
|
|||
void DeleteAllMarkers( enum MARKER_BASE::TYPEMARKER aMarkerType );
|
||||
|
||||
/**
|
||||
* Return the number of ERC markers of \a aMarkerType from all of the screens in the list.
|
||||
*
|
||||
* @param aMarkerType Indicates the type of marker to count. if MARKER_UNSPEC
|
||||
* all markers are counted.
|
||||
* @param aSeverity Indicates the error level of marker to count.
|
||||
* useMARKER_SEVERITY_UNSPEC to count all markersof the specified type
|
||||
* @return int count of the markers found.
|
||||
* Delete all markers of a particular type and error code.
|
||||
*/
|
||||
int GetMarkerCount( enum MARKER_BASE::TYPEMARKER aMarkerType,
|
||||
enum MARKER_BASE::MARKER_SEVERITY aSeverity );
|
||||
void DeleteMarkers( enum MARKER_BASE::TYPEMARKER aMarkerTyp, int aErrorCode );
|
||||
|
||||
/**
|
||||
* Delete a specific marker.
|
||||
*/
|
||||
void DeleteMarker( SCH_MARKER* aMarker );
|
||||
|
||||
/**
|
||||
* Initialize or reinitialize the weak reference to the #LIB_PART for each #SCH_COMPONENT
|
||||
|
|
|
@ -406,6 +406,61 @@ void SCH_SHEET_LIST::ClearModifyStatus()
|
|||
}
|
||||
|
||||
|
||||
SCH_ITEM* SCH_SHEET_LIST::GetItem( const KIID& aID, SCH_SHEET_PATH* aPathOut )
|
||||
{
|
||||
for( const SCH_SHEET_PATH& sheet : *this )
|
||||
{
|
||||
SCH_SCREEN* screen = sheet.LastScreen();
|
||||
|
||||
for( SCH_ITEM* aItem : screen->Items() )
|
||||
{
|
||||
if( aItem->m_Uuid == aID )
|
||||
{
|
||||
*aPathOut = sheet;
|
||||
return aItem;
|
||||
}
|
||||
else if( aItem->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
SCH_COMPONENT* comp = static_cast<SCH_COMPONENT*>( aItem );
|
||||
|
||||
for( SCH_FIELD* field : comp->GetFields() )
|
||||
{
|
||||
if( field->m_Uuid == aID )
|
||||
{
|
||||
*aPathOut = sheet;
|
||||
return field;
|
||||
}
|
||||
}
|
||||
|
||||
for( SCH_PIN* pin : comp->GetSchPins() )
|
||||
{
|
||||
if( pin->m_Uuid == aID )
|
||||
{
|
||||
*aPathOut = sheet;
|
||||
return pin;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( aItem->Type() == SCH_SHEET_T )
|
||||
{
|
||||
SCH_SHEET* sch_sheet = static_cast<SCH_SHEET*>( aItem );
|
||||
|
||||
for( SCH_SHEET_PIN* pin : sch_sheet->GetPins() )
|
||||
{
|
||||
if( pin->m_Uuid == aID )
|
||||
{
|
||||
*aPathOut = sheet;
|
||||
return pin;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
void SCH_SHEET_LIST::AnnotatePowerSymbols()
|
||||
{
|
||||
// List of reference for power symbols
|
||||
|
|
|
@ -343,6 +343,11 @@ public:
|
|||
|
||||
void ClearModifyStatus();
|
||||
|
||||
/**
|
||||
* Fetch a SCH_ITEM by ID. Also returns the sheet the item was found on in \a aPathOut.
|
||||
*/
|
||||
SCH_ITEM* GetItem( const KIID& aID, SCH_SHEET_PATH* aPathOut );
|
||||
|
||||
/**
|
||||
* Function AnnotatePowerSymbols
|
||||
* Silently annotates the not yet annotated power symbols of the entire hierarchy
|
||||
|
|
|
@ -55,11 +55,6 @@ TOOL_ACTION EE_ACTIONS::showDatasheet( "eeschema.InspectionTool.showDatasheet",
|
|||
_( "Show Datasheet" ), _( "Opens the datasheet in a browser" ),
|
||||
datasheet_xpm );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::showMarkerInfo( "eeschema.InspectionTool.showMarkerInfo",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Show Marker Info" ), _( "Display the marker's info in a dialog" ),
|
||||
info_xpm );
|
||||
|
||||
|
||||
// EE_POINT_EDITOR
|
||||
//
|
||||
|
|
|
@ -142,7 +142,6 @@ public:
|
|||
/// Inspection and Editing
|
||||
static TOOL_ACTION showDatasheet;
|
||||
static TOOL_ACTION runERC;
|
||||
static TOOL_ACTION showMarkerInfo;
|
||||
static TOOL_ACTION annotate;
|
||||
static TOOL_ACTION editSymbolFields;
|
||||
static TOOL_ACTION editSymbolLibraryLinks;
|
||||
|
|
|
@ -22,22 +22,18 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <view/view_controls.h>
|
||||
#include <sch_component.h>
|
||||
#include <sch_marker.h>
|
||||
#include <id.h>
|
||||
#include <kiway.h>
|
||||
#include <confirm.h>
|
||||
#include <tool/conditional_menu.h>
|
||||
#include <tool/selection_conditions.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/ee_actions.h>
|
||||
#include <tools/ee_inspection_tool.h>
|
||||
#include <tools/ee_selection_tool.h>
|
||||
#include <tools/ee_selection.h>
|
||||
#include <search_stack.h>
|
||||
#include <sim/sim_plot_frame.h>
|
||||
#include <sch_view.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <lib_edit_frame.h>
|
||||
#include <lib_view_frame.h>
|
||||
|
@ -66,7 +62,6 @@ bool EE_INSPECTION_TOOL::Init()
|
|||
CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu();
|
||||
|
||||
selToolMenu.AddItem( EE_ACTIONS::showDatasheet, EE_CONDITIONS::SingleSymbol && EE_CONDITIONS::Idle, 220 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::showMarkerInfo, singleMarkerCondition && EE_CONDITIONS::Idle, 220 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -298,22 +293,6 @@ int EE_INSPECTION_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int EE_INSPECTION_TOOL::ShowMarkerInfo( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
EE_SELECTION& selection = m_selectionTool->GetSelection();
|
||||
|
||||
if( selection.Empty() )
|
||||
return 0;
|
||||
|
||||
SCH_MARKER* marker = dynamic_cast<SCH_MARKER*>( selection.Front() );
|
||||
|
||||
if( marker )
|
||||
marker->DisplayMarkerInfo( m_frame );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int EE_INSPECTION_TOOL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||
|
@ -342,7 +321,6 @@ void EE_INSPECTION_TOOL::setTransitions()
|
|||
Go( &EE_INSPECTION_TOOL::RunSimulation, EE_ACTIONS::runSimulation.MakeEvent() );
|
||||
|
||||
Go( &EE_INSPECTION_TOOL::ShowDatasheet, EE_ACTIONS::showDatasheet.MakeEvent() );
|
||||
Go( &EE_INSPECTION_TOOL::ShowMarkerInfo, EE_ACTIONS::showMarkerInfo.MakeEvent() );
|
||||
|
||||
Go( &EE_INSPECTION_TOOL::UpdateMessagePanel, EVENTS::SelectedEvent );
|
||||
Go( &EE_INSPECTION_TOOL::UpdateMessagePanel, EVENTS::UnselectedEvent );
|
||||
|
|
|
@ -47,7 +47,6 @@ public:
|
|||
int RunSimulation( const TOOL_EVENT& aEvent );
|
||||
|
||||
int ShowDatasheet( const TOOL_EVENT& aEvent );
|
||||
int ShowMarkerInfo( const TOOL_EVENT& aEvent );
|
||||
|
||||
int UpdateMessagePanel( const TOOL_EVENT& aEvent );
|
||||
|
||||
|
|
|
@ -76,9 +76,7 @@ SELECTION_CONDITION EE_CONDITIONS::SingleSymbol = [] (const SELECTION& aSel )
|
|||
SCH_COMPONENT* comp = dynamic_cast<SCH_COMPONENT*>( aSel.Front() );
|
||||
|
||||
if( comp )
|
||||
{
|
||||
return !comp->GetPartRef() || !comp->GetPartRef()->IsPower();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -92,9 +90,7 @@ SELECTION_CONDITION EE_CONDITIONS::SingleDeMorganSymbol = [] ( const SELECTION&
|
|||
SCH_COMPONENT* comp = dynamic_cast<SCH_COMPONENT*>( aSel.Front() );
|
||||
|
||||
if( comp )
|
||||
{
|
||||
return comp->GetPartRef() && comp->GetPartRef()->HasConversion();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -108,9 +104,7 @@ SELECTION_CONDITION EE_CONDITIONS::SingleMultiUnitSymbol = [] ( const SELECTION&
|
|||
SCH_COMPONENT* comp = dynamic_cast<SCH_COMPONENT*>( aSel.Front() );
|
||||
|
||||
if( comp )
|
||||
{
|
||||
return comp->GetPartRef() && comp->GetPartRef()->GetUnitCount() >= 2;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -305,6 +299,8 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
// Single click? Select single object
|
||||
if( evt->IsClick( BUT_LEFT ) )
|
||||
{
|
||||
m_frame->FocusOnItem( nullptr );
|
||||
|
||||
SelectPoint( evt->Position(), EE_COLLECTOR::AllItems, nullptr, false,
|
||||
m_additive, m_subtractive, m_exclusive_or );
|
||||
}
|
||||
|
@ -329,6 +325,8 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
// double click? Display the properties window
|
||||
else if( evt->IsDblClick( BUT_LEFT ) )
|
||||
{
|
||||
m_frame->FocusOnItem( nullptr );
|
||||
|
||||
if( m_selection.Empty() )
|
||||
SelectPoint( evt->Position());
|
||||
|
||||
|
@ -343,6 +341,8 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
// drag with LMB? Select multiple objects (or at least draw a selection box) or drag them
|
||||
else if( evt->IsDrag( BUT_LEFT ) )
|
||||
{
|
||||
m_frame->FocusOnItem( nullptr );
|
||||
|
||||
if( m_additive || m_subtractive || m_exclusive_or || m_frame->GetDragSelects() )
|
||||
{
|
||||
selectMultiple();
|
||||
|
@ -391,11 +391,15 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
|
||||
else if( evt->IsCancelInteractive() )
|
||||
{
|
||||
m_frame->FocusOnItem( nullptr );
|
||||
|
||||
ClearSelection();
|
||||
}
|
||||
|
||||
else if( evt->Action() == TA_UNDO_REDO_PRE )
|
||||
{
|
||||
m_frame->FocusOnItem( nullptr );
|
||||
|
||||
ClearSelection();
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <frame_type.h>
|
||||
#include <hotkeys_basic.h>
|
||||
#include <kiway_holder.h>
|
||||
#include <widgets/ui_common.h>
|
||||
|
||||
// Option for main frames
|
||||
#define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS
|
||||
|
@ -229,6 +230,8 @@ public:
|
|||
|
||||
SETTINGS_MANAGER* GetSettingsManager() const { return m_settingsManager; }
|
||||
|
||||
virtual int GetSeverity( int aErrorCode ) const { return RPT_SEVERITY_UNDEFINED; }
|
||||
|
||||
/**
|
||||
* Return the MVC controller.
|
||||
*/
|
||||
|
|
|
@ -26,12 +26,15 @@
|
|||
#ifndef MARKER_BASE_H
|
||||
#define MARKER_BASE_H
|
||||
|
||||
#include <drc_item.h>
|
||||
#include <rc_item.h>
|
||||
#include <gr_basic.h>
|
||||
#include <eda_rect.h>
|
||||
|
||||
|
||||
class SHAPE_LINE_CHAIN;
|
||||
|
||||
/* Marker are mainly used to show a DRC or ERC error or warning
|
||||
/*
|
||||
* Marker are mainly used to show a DRC or ERC error or warning
|
||||
*/
|
||||
|
||||
|
||||
|
@ -45,111 +48,28 @@ public:
|
|||
MARKER_SIMUL
|
||||
};
|
||||
|
||||
enum MARKER_SEVERITY {
|
||||
MARKER_SEVERITY_UNSPEC,
|
||||
MARKER_SEVERITY_INFO,
|
||||
MARKER_SEVERITY_WARNING,
|
||||
MARKER_SEVERITY_ERROR
|
||||
};
|
||||
|
||||
wxPoint m_Pos; ///< position of the marker
|
||||
|
||||
protected:
|
||||
int m_ScalingFactor; // Scaling factor to convert corners coordinates
|
||||
TYPEMARKER m_markerType; // The type of marker (useful to filter markers)
|
||||
bool m_excluded; // User has excluded this specific error
|
||||
RC_ITEM* m_rcItem;
|
||||
|
||||
int m_scalingFactor; // Scaling factor to convert corners coordinates
|
||||
// to internat units coordinates
|
||||
TYPEMARKER m_MarkerType; // The type of marker (useful to filter markers)
|
||||
|
||||
// JEY TODO: retire this; error levels come from DRC_ITEM
|
||||
MARKER_SEVERITY m_ErrorLevel; // Specify the severity of the error (Eeschema only)
|
||||
bool m_Excluded; // User has excluded this specific error
|
||||
|
||||
EDA_RECT m_ShapeBoundingBox; // Bounding box of the graphic symbol, relative
|
||||
EDA_RECT m_shapeBoundingBox; // Bounding box of the graphic symbol, relative
|
||||
// to the position of the shape, in marker shape
|
||||
// units
|
||||
DRC_ITEM m_drc;
|
||||
|
||||
void init();
|
||||
|
||||
public:
|
||||
|
||||
MARKER_BASE( int aScalingFactor );
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param aErrorCode The categorizing identifier for an error
|
||||
* @param aMarkerPos The position of the MARKER on the BOARD
|
||||
* @param aItem The first of two objects
|
||||
* @param aPos The position of the first of two objects
|
||||
* @param bItem The second of the two conflicting objects
|
||||
* @param bPos The position of the second of two objects
|
||||
* @param aScalingFactor the scaling factor to convert the shape coordinates to IU coordinates
|
||||
*/
|
||||
MARKER_BASE( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
|
||||
EDA_ITEM* aItem, const wxPoint& aPos,
|
||||
EDA_ITEM* bItem, const wxPoint& bPos, int aScalingFactor );
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param aErrorCode The categorizing identifier for an error
|
||||
* @param aMarkerPos The position of the MARKER on the BOARD
|
||||
* @param aItem The first of two objects
|
||||
* @param bItem The second of the two conflicting objects
|
||||
* @param aScalingFactor the scaling factor to convert the shape coordinates to IU coordinates
|
||||
*/
|
||||
MARKER_BASE( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
|
||||
EDA_ITEM* aItem,
|
||||
EDA_ITEM* bItem, int aScalingFactor );
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param aErrorCode The categorizing identifier for an error
|
||||
* @param aMarkerPos The position of the MARKER on the BOARD
|
||||
* @param aText Text describing the first of two objects
|
||||
* @param aPos The position of the first of two objects
|
||||
* @param bText Text describing the second of the two conflicting objects
|
||||
* @param bPos The position of the second of two objects
|
||||
* @param aScalingFactor the scaling factor to convert the shape coordinates to IU coordinates
|
||||
*/
|
||||
MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
|
||||
const wxString& aText, const wxPoint& aPos,
|
||||
const wxString& bText, const wxPoint& bPos, int aScalingFactor );
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param aErrorCode The categorizing identifier for an error
|
||||
* @param aMarkerPos The position of the MARKER on the BOARD
|
||||
* @param aText Text describing the first of two objects
|
||||
* @param bText Text describing the second of the two conflicting objects
|
||||
* @param aScalingFactor the scaling factor to convert the shape coordinates to IU coordinates
|
||||
*/
|
||||
MARKER_BASE( int aErrorCode, const wxPoint& aMarkerPos,
|
||||
const wxString& aText,
|
||||
const wxString& bText, int aScalingFactor );
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param aErrorCode The categorizing identifier for an error
|
||||
* @param aText Text describing the object
|
||||
* @param bText Text describing the second of the two conflicting objects
|
||||
* @param aScalingFactor the scaling factor to convert the shape coordinates to IU coordinates
|
||||
*/
|
||||
MARKER_BASE( int aErrorCode,
|
||||
const wxString& aText,
|
||||
const wxString& bText, int aScalingFactor );
|
||||
|
||||
/**
|
||||
* Contructor
|
||||
* makes a copy of \a aMarker but does not copy the DRC_ITEM.
|
||||
*
|
||||
* @param aMarker The marker to copy.
|
||||
*/
|
||||
MARKER_BASE( const MARKER_BASE& aMarker );
|
||||
MARKER_BASE( int aScalingFactor, RC_ITEM* aItem, TYPEMARKER aType = MARKER_UNSPEC );
|
||||
|
||||
virtual ~MARKER_BASE();
|
||||
|
||||
/** The scaling factor to convert polygonal shape coordinates to internal units
|
||||
*/
|
||||
int MarkerScale() const { return m_ScalingFactor; }
|
||||
int MarkerScale() const { return m_scalingFactor; }
|
||||
|
||||
/** Returns the shape polygon in internal units in a SHAPE_LINE_CHAIN
|
||||
* the coordinates are relatives to the marker position (are not absolute)
|
||||
|
@ -157,18 +77,6 @@ public:
|
|||
*/
|
||||
void ShapeToPolygon( SHAPE_LINE_CHAIN& aPolygon) const;
|
||||
|
||||
/** @return the shape corner list
|
||||
*/
|
||||
const VECTOR2I* GetShapePolygon() const;
|
||||
|
||||
/** @return the shape polygon corner aIdx
|
||||
*/
|
||||
const VECTOR2I& GetShapePolygonCorner( int aIdx ) const;
|
||||
|
||||
/** @return the default shape polygon corner count
|
||||
*/
|
||||
int GetShapePolygonCornerCount() const;
|
||||
|
||||
/**
|
||||
* Function PrintMarker
|
||||
* Prints the shape is the polygon defined in m_Corners (array of wxPoints).
|
||||
|
@ -179,22 +87,15 @@ public:
|
|||
* Function GetPos
|
||||
* @return the position of this MARKER in internal units.
|
||||
*/
|
||||
const wxPoint& GetPos() const
|
||||
{
|
||||
return m_Pos;
|
||||
}
|
||||
const wxPoint& GetPos() const { return m_Pos; }
|
||||
|
||||
/**
|
||||
* accessors to set/get error levels (warning, error, fatal error..)
|
||||
*/
|
||||
void SetErrorLevel( MARKER_SEVERITY aErrorLevel ) { m_ErrorLevel = aErrorLevel; }
|
||||
MARKER_SEVERITY GetErrorLevel() const { return m_ErrorLevel; }
|
||||
virtual const KIID GetUUID() const = 0;
|
||||
|
||||
/**
|
||||
* accessors to set/get marker type (DRC, ERC, or other)
|
||||
*/
|
||||
void SetMarkerType( enum TYPEMARKER aMarkerType ) { m_MarkerType = aMarkerType; }
|
||||
enum TYPEMARKER GetMarkerType() const { return m_MarkerType; }
|
||||
void SetMarkerType( enum TYPEMARKER aMarkerType ) { m_markerType = aMarkerType; }
|
||||
enum TYPEMARKER GetMarkerType() const { return m_markerType; }
|
||||
|
||||
/**
|
||||
* Function SetData
|
||||
|
@ -254,7 +155,7 @@ public:
|
|||
|
||||
void SetData( int aErrorCode, const wxPoint& aMarkerPos,
|
||||
const wxString& aText, const KIID& aID,
|
||||
const wxString& bText, const KIID& bID );
|
||||
const wxString& bText = wxEmptyString, const KIID& bID = niluuid );
|
||||
|
||||
/**
|
||||
* Function SetAuxiliaryData
|
||||
|
@ -265,11 +166,11 @@ public:
|
|||
*/
|
||||
void SetAuxiliaryData( const wxString& aAuxiliaryText, const wxPoint& aAuxiliaryPos )
|
||||
{
|
||||
m_drc.SetAuxiliaryData( aAuxiliaryText, aAuxiliaryPos );
|
||||
m_rcItem->SetAuxiliaryData( aAuxiliaryText, aAuxiliaryPos );
|
||||
}
|
||||
|
||||
bool IsExcluded() const { return m_Excluded; }
|
||||
void SetExcluded( bool aExcluded ) { m_Excluded = aExcluded; }
|
||||
bool IsExcluded() const { return m_excluded; }
|
||||
void SetExcluded( bool aExcluded ) { m_excluded = aExcluded; }
|
||||
|
||||
/**
|
||||
* Function GetReporter
|
||||
|
@ -277,14 +178,8 @@ public:
|
|||
* interface may be used.
|
||||
* @return const& DRC_ITEM
|
||||
*/
|
||||
DRC_ITEM& GetReporter() { return m_drc; }
|
||||
const DRC_ITEM& GetReporter() const { return m_drc; }
|
||||
|
||||
/**
|
||||
* Function DisplayMarkerInfo
|
||||
* displays the full info of this marker, in a HTML window.
|
||||
*/
|
||||
void DisplayMarkerInfo( EDA_DRAW_FRAME* aFrame );
|
||||
RC_ITEM* GetRCItem() { return m_rcItem; }
|
||||
const RC_ITEM* GetRCItem() const { return m_rcItem; }
|
||||
|
||||
/**
|
||||
* Tests if the given wxPoint is within the bounds of this object.
|
||||
|
|
|
@ -229,7 +229,6 @@ set( PCBNEW_DRC_SRCS
|
|||
drc/courtyard_overlap.cpp
|
||||
drc/drc.cpp
|
||||
drc/drc_clearance_test_functions.cpp
|
||||
drc/drc_tree_model.cpp
|
||||
)
|
||||
|
||||
set( PCBNEW_NETLIST_SRCS
|
||||
|
|
|
@ -575,7 +575,11 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
|
|||
|
||||
m_DRCSeverities[ DRCE_MISSING_COURTYARD_IN_FOOTPRINT ] = RPT_SEVERITY_IGNORE;
|
||||
|
||||
m_MaxError = ARC_HIGH_DEF;
|
||||
m_DRCSeverities[ DRCE_MISSING_FOOTPRINT ] = RPT_SEVERITY_WARNING;
|
||||
m_DRCSeverities[ DRCE_DUPLICATE_FOOTPRINT ] = RPT_SEVERITY_WARNING;
|
||||
m_DRCSeverities[ DRCE_EXTRA_FOOTPRINT ] = RPT_SEVERITY_WARNING;
|
||||
|
||||
m_MaxError = ARC_HIGH_DEF;
|
||||
m_ZoneUseNoOutlineInFill = false; // Use compatibility mode by default
|
||||
|
||||
// Global mask margins:
|
||||
|
|
|
@ -29,16 +29,15 @@
|
|||
#include <msgpanel.h>
|
||||
#include <bitmaps.h>
|
||||
#include <base_units.h>
|
||||
#include <pcbnew.h>
|
||||
#include <class_board.h>
|
||||
#include <class_board_item.h>
|
||||
#include <class_marker_pcb.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <widgets/ui_common.h>
|
||||
#include <pgm_base.h>
|
||||
#include <drc/drc_item.h>
|
||||
|
||||
|
||||
/// Factor to convert the maker unit shape to internal units:
|
||||
|
@ -46,7 +45,8 @@
|
|||
|
||||
MARKER_PCB::MARKER_PCB( BOARD_ITEM* aParent ) :
|
||||
BOARD_ITEM( aParent, PCB_MARKER_T ),
|
||||
MARKER_BASE( SCALING_FACTOR ), m_item( nullptr )
|
||||
MARKER_BASE( SCALING_FACTOR, new DRC_ITEM() ),
|
||||
m_item( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -55,9 +55,10 @@ MARKER_PCB::MARKER_PCB( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarker
|
|||
BOARD_ITEM* aItem,
|
||||
BOARD_ITEM* bItem ) :
|
||||
BOARD_ITEM( nullptr, PCB_MARKER_T ), // parent set during BOARD::Add()
|
||||
MARKER_BASE( aUnits, aErrorCode, aMarkerPos, aItem, bItem, SCALING_FACTOR ),
|
||||
MARKER_BASE( SCALING_FACTOR, new DRC_ITEM() ),
|
||||
m_item( nullptr )
|
||||
{
|
||||
SetData( aUnits, aErrorCode, aMarkerPos, aItem, bItem );
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,9 +66,10 @@ MARKER_PCB::MARKER_PCB( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarker
|
|||
BOARD_ITEM* aItem, const wxPoint& aPos,
|
||||
BOARD_ITEM* bItem, const wxPoint& bPos ) :
|
||||
BOARD_ITEM( nullptr, PCB_MARKER_T ), // parent set during BOARD::Add()
|
||||
MARKER_BASE( aUnits, aErrorCode, aMarkerPos, aItem, aPos, bItem, bPos, SCALING_FACTOR ),
|
||||
MARKER_BASE( SCALING_FACTOR, new DRC_ITEM() ),
|
||||
m_item( nullptr )
|
||||
{
|
||||
SetData( aUnits, aErrorCode, aMarkerPos, aItem, aPos, bItem, bPos );
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,8 +77,10 @@ MARKER_PCB::MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
|
|||
const wxString& aText, const wxPoint& aPos,
|
||||
const wxString& bText, const wxPoint& bPos ) :
|
||||
BOARD_ITEM( nullptr, PCB_MARKER_T ), // parent set during BOARD::Add()
|
||||
MARKER_BASE( aErrorCode, aMarkerPos, aText, aPos, bText, bPos, SCALING_FACTOR ), m_item( nullptr )
|
||||
MARKER_BASE( SCALING_FACTOR, new DRC_ITEM() ),
|
||||
m_item( nullptr )
|
||||
{
|
||||
SetData( aErrorCode, aMarkerPos, aText, aPos, bText, bPos );
|
||||
}
|
||||
|
||||
|
||||
|
@ -84,8 +88,10 @@ MARKER_PCB::MARKER_PCB( int aErrorCode,
|
|||
const wxString& aText,
|
||||
const wxString& bText) :
|
||||
BOARD_ITEM( nullptr, PCB_MARKER_T ), // parent set during BOARD::Add()
|
||||
MARKER_BASE( aErrorCode, aText, bText, SCALING_FACTOR ), m_item( nullptr )
|
||||
MARKER_BASE( SCALING_FACTOR, new DRC_ITEM() ),
|
||||
m_item( nullptr )
|
||||
{
|
||||
SetData( aErrorCode, wxDefaultPosition, aText, bText );
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,13 +104,13 @@ MARKER_PCB::~MARKER_PCB()
|
|||
wxString MARKER_PCB::Serialize() const
|
||||
{
|
||||
return wxString::Format( wxT( "%d|%d|%d|%s|%s|%s|%s" ),
|
||||
m_drc.GetErrorCode(),
|
||||
m_rcItem->GetErrorCode(),
|
||||
m_Pos.x,
|
||||
m_Pos.y,
|
||||
m_drc.GetMainText(),
|
||||
m_drc.GetMainItemID().AsString(),
|
||||
m_drc.GetAuxiliaryText(),
|
||||
m_drc.GetAuxItemID().AsString() );
|
||||
m_rcItem->GetMainText(),
|
||||
m_rcItem->GetMainItemID().AsString(),
|
||||
m_rcItem->GetAuxText(),
|
||||
m_rcItem->GetAuxItemID().AsString() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -116,8 +122,8 @@ MARKER_PCB* MARKER_PCB::Deserialize( const wxString& data )
|
|||
|
||||
marker->m_Pos.x = (int) strtol( props[1].c_str(), nullptr, 10 );
|
||||
marker->m_Pos.y = (int) strtol( props[2].c_str(), nullptr, 10 );
|
||||
marker->m_drc.SetData( errorCode, props[3], KIID( props[4] ), props[5], KIID( props[6] ) );
|
||||
marker->m_drc.SetParent( marker );
|
||||
marker->m_rcItem->SetData( errorCode, props[3], KIID( props[4] ), props[5], KIID( props[6] ) );
|
||||
marker->m_rcItem->SetParent( marker );
|
||||
return marker;
|
||||
}
|
||||
|
||||
|
@ -137,11 +143,9 @@ bool MARKER_PCB::IsOnLayer( PCB_LAYER_ID aLayer ) const
|
|||
|
||||
void MARKER_PCB::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
aList.emplace_back( MSG_PANEL_ITEM( _( "Type" ), _( "Marker" ), DARKCYAN ) );
|
||||
|
||||
aList.emplace_back( MSG_PANEL_ITEM( _( "Violation" ), m_drc.GetErrorText(), RED ) );
|
||||
|
||||
aList.emplace_back( MSG_PANEL_ITEM( m_drc.GetTextA(), m_drc.GetTextB(), DARKBROWN ) );
|
||||
aList.emplace_back( _( "Type" ), _( "Marker" ), DARKCYAN );
|
||||
aList.emplace_back( _( "Violation" ), m_rcItem->GetErrorText(), RED );
|
||||
aList.emplace_back( m_rcItem->GetMainText(), m_rcItem->GetAuxText(), DARKBROWN );
|
||||
}
|
||||
|
||||
|
||||
|
@ -162,7 +166,7 @@ void MARKER_PCB::Flip(const wxPoint& aCentre, bool aFlipLeftRight )
|
|||
|
||||
wxString MARKER_PCB::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
{
|
||||
return wxString::Format( _( "Marker (%s)" ), GetReporter().GetErrorText() );
|
||||
return wxString::Format( _( "Marker (%s)" ), m_rcItem->GetErrorText() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -183,7 +187,7 @@ void MARKER_PCB::ViewGetLayers( int aLayers[], int& aCount ) const
|
|||
|
||||
BOARD* board = static_cast<BOARD*>( ancestor );
|
||||
|
||||
switch( board->GetDesignSettings().GetSeverity( m_drc.GetErrorCode() ) )
|
||||
switch( board->GetDesignSettings().GetSeverity( m_rcItem->GetErrorCode() ) )
|
||||
{
|
||||
default:
|
||||
case SEVERITY::RPT_SEVERITY_ERROR: aLayers[0] = LAYER_DRC_ERROR; break;
|
||||
|
@ -204,7 +208,7 @@ GAL_LAYER_ID MARKER_PCB::GetColorLayer() const
|
|||
|
||||
BOARD* board = static_cast<BOARD*>( ancestor );
|
||||
|
||||
switch( board->GetDesignSettings().GetSeverity( m_drc.GetErrorCode() ) )
|
||||
switch( board->GetDesignSettings().GetSeverity( m_rcItem->GetErrorCode() ) )
|
||||
{
|
||||
default:
|
||||
case SEVERITY::RPT_SEVERITY_ERROR: return LAYER_DRC_ERROR;
|
||||
|
@ -222,7 +226,7 @@ KIGFX::COLOR4D MARKER_PCB::getColor() const
|
|||
|
||||
const EDA_RECT MARKER_PCB::GetBoundingBox() const
|
||||
{
|
||||
EDA_RECT bbox = m_ShapeBoundingBox;
|
||||
EDA_RECT bbox = m_shapeBoundingBox;
|
||||
|
||||
wxPoint pos = m_Pos;
|
||||
pos.x += int( bbox.GetOrigin().x * MarkerScale() );
|
||||
|
|
|
@ -101,6 +101,8 @@ public:
|
|||
return aItem && PCB_MARKER_T == aItem->Type();
|
||||
}
|
||||
|
||||
const KIID GetUUID() const override { return m_Uuid; }
|
||||
|
||||
wxString Serialize() const;
|
||||
|
||||
static MARKER_PCB* Deserialize( const wxString& data );
|
||||
|
@ -135,7 +137,7 @@ public:
|
|||
|
||||
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override
|
||||
{
|
||||
return BOARD_ITEM::Matches( m_drc.GetErrorText(), aSearchData );
|
||||
return BOARD_ITEM::Matches( m_rcItem->GetErrorText(), aSearchData );
|
||||
}
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <../board_stackup_manager/panel_board_stackup.h>
|
||||
#include <kiface_i.h>
|
||||
#include <drc/drc.h>
|
||||
#include <drc/drc_item.h>
|
||||
#include <dialog_import_settings.h>
|
||||
#include <panel_setup_severities.h>
|
||||
|
||||
|
@ -46,7 +47,10 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
|
|||
m_tracksAndVias = new PANEL_SETUP_TRACKS_AND_VIAS( this, aFrame, m_constraints );
|
||||
m_maskAndPaste = new PANEL_SETUP_MASK_AND_PASTE( this, aFrame );
|
||||
m_physicalStackup = new PANEL_SETUP_BOARD_STACKUP( this, aFrame, m_layers );
|
||||
m_severities = new PANEL_SETUP_SEVERITIES( this, aFrame->GetDesignSettings().m_DRCSeverities,
|
||||
|
||||
DRC_ITEM dummyItem;
|
||||
BOARD_DESIGN_SETTINGS& bds = aFrame->GetDesignSettings();
|
||||
m_severities = new PANEL_SETUP_SEVERITIES( this, dummyItem, bds.m_DRCSeverities,
|
||||
DRCE_FIRST, DRCE_LAST );
|
||||
|
||||
/*
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
*/
|
||||
#include <wx/wx.h>
|
||||
|
||||
#include <drc/drc_tree_model.h>
|
||||
#include <board_commit.h>
|
||||
#include <dialog_cleanup_tracks_and_vias.h>
|
||||
#include <kiface_i.h>
|
||||
|
@ -32,7 +31,7 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <tracks_cleaner.h>
|
||||
|
||||
#include <drc/drc_item.h>
|
||||
|
||||
DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS( PCB_EDIT_FRAME* aParentFrame ):
|
||||
DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE( aParentFrame ),
|
||||
|
@ -46,7 +45,7 @@ DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS( PCB_EDIT_FRAME*
|
|||
m_cleanShortCircuitOpt->SetValue( cfg->m_Cleanup.cleanup_short_circuits );
|
||||
m_deleteTracksInPadsOpt->SetValue( cfg->m_Cleanup.cleanup_tracks_in_pad );
|
||||
|
||||
m_changesTreeModel = new DRC_TREE_MODEL( m_parentFrame, m_changesDataView );
|
||||
m_changesTreeModel = new RC_TREE_MODEL( m_parentFrame, m_changesDataView );
|
||||
m_changesDataView->AssociateModel( m_changesTreeModel );
|
||||
|
||||
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
|
||||
|
@ -124,7 +123,7 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup( bool aDryRun )
|
|||
|
||||
if( aDryRun )
|
||||
{
|
||||
DRC_ITEMS_PROVIDER* provider = new VECTOR_DRC_ITEMS_PROVIDER( m_parentFrame, &m_items );
|
||||
RC_ITEMS_PROVIDER* provider = new VECTOR_DRC_ITEMS_PROVIDER( m_parentFrame, &m_items );
|
||||
m_changesTreeModel->SetProvider( provider );
|
||||
}
|
||||
else if( modified )
|
||||
|
@ -136,15 +135,16 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup( bool aDryRun )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_CLEANUP_TRACKS_AND_VIAS::OnSelectItem( wxDataViewEvent& event )
|
||||
void DIALOG_CLEANUP_TRACKS_AND_VIAS::OnSelectItem( wxDataViewEvent& aEvent )
|
||||
{
|
||||
BOARD_ITEM* item = DRC_TREE_MODEL::ToBoardItem( m_parentFrame->GetBoard(), event.GetItem() );
|
||||
const KIID& itemID = RC_TREE_MODEL::ToUUID( aEvent.GetItem() );
|
||||
BOARD_ITEM* item = m_parentFrame->GetBoard()->GetItem( itemID );
|
||||
WINDOW_THAWER thawer( m_parentFrame );
|
||||
|
||||
m_parentFrame->FocusOnItem( item );
|
||||
m_parentFrame->GetCanvas()->Refresh();
|
||||
|
||||
event.Skip();
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@ class DRC_TREE_MODEL;
|
|||
|
||||
class DIALOG_CLEANUP_TRACKS_AND_VIAS: public DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE
|
||||
{
|
||||
PCB_EDIT_FRAME* m_parentFrame;
|
||||
DRC_LIST m_items;
|
||||
DRC_TREE_MODEL* m_changesTreeModel;
|
||||
PCB_EDIT_FRAME* m_parentFrame;
|
||||
std::vector<DRC_ITEM*> m_items;
|
||||
RC_TREE_MODEL* m_changesTreeModel;
|
||||
|
||||
void doCleanup( bool aDryRun );
|
||||
|
||||
|
|
|
@ -36,13 +36,12 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <drc/drc_tree_model.h>
|
||||
#include <rc_item.h>
|
||||
#include <wx/wupdlock.h>
|
||||
#include <widgets/ui_common.h>
|
||||
|
||||
DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFrame,
|
||||
wxWindow* aParent ) :
|
||||
DIALOG_DRC_CONTROL_BASE( aParent ),
|
||||
DIALOG_DRC::DIALOG_DRC( DRC* aTester, PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
|
||||
DIALOG_DRC_BASE( aParent ),
|
||||
m_trackMinWidth( aEditorFrame, m_MinWidthLabel, m_MinWidthCtrl, m_MinWidthUnits, true ),
|
||||
m_viaMinSize( aEditorFrame, m_ViaMinLabel, m_ViaMinCtrl, m_ViaMinUnits, true ),
|
||||
m_uviaMinSize( aEditorFrame, m_uViaMinLabel, m_uViaMinCtrl, m_uViaMinUnits, true ),
|
||||
|
@ -61,13 +60,13 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFra
|
|||
m_currentBoard = m_brdEditor->GetBoard();
|
||||
m_BrdSettings = m_brdEditor->GetBoard()->GetDesignSettings();
|
||||
|
||||
m_markerTreeModel = new DRC_TREE_MODEL( m_brdEditor, m_markerDataView );
|
||||
m_markerTreeModel = new RC_TREE_MODEL( m_brdEditor, m_markerDataView );
|
||||
m_markerDataView->AssociateModel( m_markerTreeModel );
|
||||
|
||||
m_unconnectedTreeModel = new DRC_TREE_MODEL( m_brdEditor, m_unconnectedDataView );
|
||||
m_unconnectedTreeModel = new RC_TREE_MODEL( m_brdEditor, m_unconnectedDataView );
|
||||
m_unconnectedDataView->AssociateModel( m_unconnectedTreeModel );
|
||||
|
||||
m_footprintWarningsTreeModel = new DRC_TREE_MODEL( m_brdEditor, m_footprintsDataView );
|
||||
m_footprintWarningsTreeModel = new RC_TREE_MODEL( m_brdEditor, m_footprintsDataView );
|
||||
m_footprintsDataView->AssociateModel( m_footprintWarningsTreeModel );
|
||||
|
||||
m_Notebook->SetSelection( 0 );
|
||||
|
@ -86,7 +85,7 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFra
|
|||
}
|
||||
|
||||
|
||||
DIALOG_DRC_CONTROL::~DIALOG_DRC_CONTROL()
|
||||
DIALOG_DRC::~DIALOG_DRC()
|
||||
{
|
||||
m_brdEditor->FocusOnItem( nullptr );
|
||||
|
||||
|
@ -100,7 +99,7 @@ DIALOG_DRC_CONTROL::~DIALOG_DRC_CONTROL()
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::OnActivateDlg( wxActivateEvent& aEvent )
|
||||
void DIALOG_DRC::OnActivateDlg( wxActivateEvent& aEvent )
|
||||
{
|
||||
if( m_currentBoard != m_brdEditor->GetBoard() )
|
||||
{
|
||||
|
@ -126,7 +125,7 @@ void DIALOG_DRC_CONTROL::OnActivateDlg( wxActivateEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::displayDRCValues()
|
||||
void DIALOG_DRC::displayDRCValues()
|
||||
{
|
||||
m_trackMinWidth.SetValue( m_BrdSettings.m_TrackMinWidth );
|
||||
m_viaMinSize.SetValue( m_BrdSettings.m_ViasMinSize );
|
||||
|
@ -134,7 +133,7 @@ void DIALOG_DRC_CONTROL::displayDRCValues()
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::initValues()
|
||||
void DIALOG_DRC::initValues()
|
||||
{
|
||||
m_markersTitleTemplate = m_Notebook->GetPageText( 0 );
|
||||
m_unconnectedTitleTemplate = m_Notebook->GetPageText( 1 );
|
||||
|
@ -159,7 +158,7 @@ void DIALOG_DRC_CONTROL::initValues()
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::setDRCParameters()
|
||||
void DIALOG_DRC::setDRCParameters()
|
||||
{
|
||||
m_BrdSettings.m_TrackMinWidth = (int) m_trackMinWidth.GetValue();
|
||||
m_BrdSettings.m_ViasMinSize = (int) m_viaMinSize.GetValue();
|
||||
|
@ -173,7 +172,7 @@ void DIALOG_DRC_CONTROL::setDRCParameters()
|
|||
static int RPT_SEVERITY_ALL = RPT_SEVERITY_WARNING | RPT_SEVERITY_ERROR | RPT_SEVERITY_EXCLUSION;
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::syncCheckboxes()
|
||||
void DIALOG_DRC::syncCheckboxes()
|
||||
{
|
||||
m_showAll->SetValue( m_severities == RPT_SEVERITY_ALL );
|
||||
m_showErrors->SetValue( m_severities & RPT_SEVERITY_ERROR );
|
||||
|
@ -182,7 +181,7 @@ void DIALOG_DRC_CONTROL::syncCheckboxes()
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::OnRunDRCClick( wxCommandEvent& aEvent )
|
||||
void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
setDRCParameters();
|
||||
m_tester->m_doZonesTest = m_cbReportTracksToZonesErrors->GetValue();
|
||||
|
@ -211,7 +210,7 @@ void DIALOG_DRC_CONTROL::OnRunDRCClick( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::SetMarkersProvider( DRC_ITEMS_PROVIDER* aProvider )
|
||||
void DIALOG_DRC::SetMarkersProvider( RC_ITEMS_PROVIDER* aProvider )
|
||||
{
|
||||
m_markersProvider = aProvider;
|
||||
m_markerTreeModel->SetProvider( m_markersProvider );
|
||||
|
@ -219,7 +218,7 @@ void DIALOG_DRC_CONTROL::SetMarkersProvider( DRC_ITEMS_PROVIDER* aProvider )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::SetUnconnectedProvider(class DRC_ITEMS_PROVIDER * aProvider )
|
||||
void DIALOG_DRC::SetUnconnectedProvider( class RC_ITEMS_PROVIDER * aProvider )
|
||||
{
|
||||
m_unconnectedItemsProvider = aProvider;
|
||||
m_unconnectedTreeModel->SetProvider( m_unconnectedItemsProvider );
|
||||
|
@ -227,7 +226,7 @@ void DIALOG_DRC_CONTROL::SetUnconnectedProvider(class DRC_ITEMS_PROVIDER * aProv
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::SetFootprintsProvider( DRC_ITEMS_PROVIDER* aProvider )
|
||||
void DIALOG_DRC::SetFootprintsProvider( RC_ITEMS_PROVIDER* aProvider )
|
||||
{
|
||||
m_footprintWarningsProvider = aProvider;
|
||||
m_footprintWarningsTreeModel->SetProvider( m_footprintWarningsProvider );
|
||||
|
@ -235,9 +234,10 @@ void DIALOG_DRC_CONTROL::SetFootprintsProvider( DRC_ITEMS_PROVIDER* aProvider )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::OnDRCItemSelected( wxDataViewEvent& aEvent )
|
||||
void DIALOG_DRC::OnDRCItemSelected( wxDataViewEvent& aEvent )
|
||||
{
|
||||
BOARD_ITEM* item = DRC_TREE_MODEL::ToBoardItem( m_brdEditor->GetBoard(), aEvent.GetItem() );
|
||||
const KIID& itemID = RC_TREE_MODEL::ToUUID( aEvent.GetItem() );
|
||||
BOARD_ITEM* item = m_brdEditor->GetBoard()->GetItem( itemID );
|
||||
WINDOW_THAWER thawer( m_brdEditor );
|
||||
|
||||
m_brdEditor->FocusOnItem( item );
|
||||
|
@ -247,11 +247,11 @@ void DIALOG_DRC_CONTROL::OnDRCItemSelected( wxDataViewEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::OnDRCItemDClick( wxDataViewEvent& aEvent )
|
||||
void DIALOG_DRC::OnDRCItemDClick( wxDataViewEvent& aEvent )
|
||||
{
|
||||
if( aEvent.GetItem().IsOk() )
|
||||
{
|
||||
// turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window,
|
||||
// turn control over to m_brdEditor, hide this DIALOG_DRC window,
|
||||
// no destruction so we can preserve listbox cursor
|
||||
if( !IsModal() )
|
||||
Show( false );
|
||||
|
@ -261,25 +261,25 @@ void DIALOG_DRC_CONTROL::OnDRCItemDClick( wxDataViewEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
||||
void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
||||
{
|
||||
DRC_TREE_NODE* node = DRC_TREE_MODEL::ToNode( aEvent.GetItem() );
|
||||
RC_TREE_NODE* node = RC_TREE_MODEL::ToNode( aEvent.GetItem() );
|
||||
|
||||
if( !node )
|
||||
return;
|
||||
|
||||
DRC_ITEM* drcItem = node->m_DrcItem;
|
||||
RC_ITEM* rcItem = node->m_RcItem;
|
||||
wxString listName;
|
||||
wxMenu menu;
|
||||
|
||||
switch( m_BrdSettings.m_DRCSeverities[ drcItem->GetErrorCode() ] )
|
||||
switch( m_BrdSettings.m_DRCSeverities[ rcItem->GetErrorCode() ] )
|
||||
{
|
||||
case RPT_SEVERITY_ERROR: listName = _( "errors" ); break;
|
||||
case RPT_SEVERITY_WARNING: listName = _( "warnings" ); break;
|
||||
default: listName = _( "appropriate" ); break;
|
||||
default: listName = _( "appropriate" ); break;
|
||||
}
|
||||
|
||||
if( drcItem->GetParent()->IsExcluded() )
|
||||
if( rcItem->GetParent()->IsExcluded() )
|
||||
{
|
||||
menu.Append( 1, _( "Remove exclusion for this violation" ),
|
||||
wxString::Format( _( "It will be placed back in the %s list" ), listName ) );
|
||||
|
@ -292,21 +292,21 @@ void DIALOG_DRC_CONTROL::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
|||
|
||||
menu.AppendSeparator();
|
||||
|
||||
if( m_BrdSettings.m_DRCSeverities[ drcItem->GetErrorCode() ] == RPT_SEVERITY_WARNING )
|
||||
if( m_BrdSettings.m_DRCSeverities[ rcItem->GetErrorCode() ] == RPT_SEVERITY_WARNING )
|
||||
{
|
||||
menu.Append( 3, wxString::Format( _( "Change severity to Error for all '%s' violations" ),
|
||||
drcItem->GetErrorText(),
|
||||
rcItem->GetErrorText(),
|
||||
_( "Violation severities can also be edited in the Board Setup... dialog" ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
menu.Append( 4, wxString::Format( _( "Change severity to Warning for all '%s' violations" ),
|
||||
drcItem->GetErrorText(),
|
||||
rcItem->GetErrorText(),
|
||||
_( "Violation severities can also be edited in the Board Setup... dialog" ) ) );
|
||||
}
|
||||
|
||||
menu.Append( 5, wxString::Format( _( "Ignore all '%s' violations" ),
|
||||
drcItem->GetErrorText() ),
|
||||
rcItem->GetErrorText() ),
|
||||
_( "Violations will not be checked or reported" ) );
|
||||
|
||||
menu.AppendSeparator();
|
||||
|
@ -316,55 +316,55 @@ void DIALOG_DRC_CONTROL::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
|||
switch( GetPopupMenuSelectionFromUser( menu ) )
|
||||
{
|
||||
case 1:
|
||||
node->m_DrcItem->GetParent()->SetExcluded( false );
|
||||
node->m_RcItem->GetParent()->SetExcluded( false );
|
||||
|
||||
// Update view
|
||||
static_cast<DRC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
|
||||
updateDisplayedCounts();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
node->m_DrcItem->GetParent()->SetExcluded( true );
|
||||
node->m_RcItem->GetParent()->SetExcluded( true );
|
||||
|
||||
// Update view
|
||||
if( m_severities & RPT_SEVERITY_EXCLUSION )
|
||||
static_cast<DRC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
|
||||
else
|
||||
static_cast<DRC_TREE_MODEL*>( aEvent.GetModel() )->DeleteCurrentItem( false );
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->DeleteCurrentItem( false );
|
||||
|
||||
updateDisplayedCounts();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
m_BrdSettings.m_DRCSeverities[ drcItem->GetErrorCode() ] = RPT_SEVERITY_ERROR;
|
||||
m_BrdSettings.m_DRCSeverities[ rcItem->GetErrorCode() ] = RPT_SEVERITY_ERROR;
|
||||
m_brdEditor->GetBoard()->SetDesignSettings( m_BrdSettings );
|
||||
|
||||
// Rebuild model and view
|
||||
static_cast<DRC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
|
||||
updateDisplayedCounts();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
m_BrdSettings.m_DRCSeverities[ drcItem->GetErrorCode() ] = RPT_SEVERITY_WARNING;
|
||||
m_BrdSettings.m_DRCSeverities[ rcItem->GetErrorCode() ] = RPT_SEVERITY_WARNING;
|
||||
m_brdEditor->GetBoard()->SetDesignSettings( m_BrdSettings );
|
||||
|
||||
// Rebuild model and view
|
||||
static_cast<DRC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
|
||||
updateDisplayedCounts();
|
||||
break;
|
||||
|
||||
case 5:
|
||||
m_BrdSettings.m_DRCSeverities[ drcItem->GetErrorCode() ] = RPT_SEVERITY_IGNORE;
|
||||
m_BrdSettings.m_DRCSeverities[ rcItem->GetErrorCode() ] = RPT_SEVERITY_IGNORE;
|
||||
m_brdEditor->GetBoard()->SetDesignSettings( m_BrdSettings );
|
||||
|
||||
for( MARKER_PCB* marker : m_brdEditor->GetBoard()->Markers() )
|
||||
{
|
||||
if( marker->GetReporter().GetErrorCode() == drcItem->GetErrorCode() )
|
||||
if( marker->GetRCItem()->GetErrorCode() == rcItem->GetErrorCode() )
|
||||
m_brdEditor->GetBoard()->Delete( marker );
|
||||
}
|
||||
|
||||
// Rebuild model and view
|
||||
static_cast<DRC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
|
||||
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
|
||||
updateDisplayedCounts();
|
||||
break;
|
||||
|
||||
|
@ -375,7 +375,7 @@ void DIALOG_DRC_CONTROL::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::OnSeverity( wxCommandEvent& aEvent )
|
||||
void DIALOG_DRC::OnSeverity( wxCommandEvent& aEvent )
|
||||
{
|
||||
int flag = 0;
|
||||
|
||||
|
@ -411,7 +411,7 @@ void DIALOG_DRC_CONTROL::OnSeverity( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::OnSaveReport( wxCommandEvent& aEvent )
|
||||
void DIALOG_DRC::OnSaveReport( wxCommandEvent& aEvent )
|
||||
{
|
||||
wxFileName fn( "./DRC." + ReportFileExtension );
|
||||
|
||||
|
@ -445,7 +445,7 @@ void DIALOG_DRC_CONTROL::OnSaveReport( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::OnCancelClick( wxCommandEvent& aEvent )
|
||||
void DIALOG_DRC::OnCancelClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_brdEditor->FocusOnItem( nullptr );
|
||||
|
||||
|
@ -458,7 +458,7 @@ void DIALOG_DRC_CONTROL::OnCancelClick( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::OnChangingNotebookPage( wxNotebookEvent& aEvent )
|
||||
void DIALOG_DRC::OnChangingNotebookPage( wxNotebookEvent& aEvent )
|
||||
{
|
||||
// Shouldn't be necessary, but is on at least OSX
|
||||
if( aEvent.GetSelection() >= 0 )
|
||||
|
@ -470,7 +470,7 @@ void DIALOG_DRC_CONTROL::OnChangingNotebookPage( wxNotebookEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::refreshBoardEditor()
|
||||
void DIALOG_DRC::refreshBoardEditor()
|
||||
{
|
||||
WINDOW_THAWER thawer( m_brdEditor );
|
||||
|
||||
|
@ -478,7 +478,7 @@ void DIALOG_DRC_CONTROL::refreshBoardEditor()
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::deleteAllMarkers()
|
||||
void DIALOG_DRC::deleteAllMarkers()
|
||||
{
|
||||
// Clear current selection list to avoid selection of deleted items
|
||||
m_brdEditor->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
@ -488,7 +488,7 @@ void DIALOG_DRC_CONTROL::deleteAllMarkers()
|
|||
}
|
||||
|
||||
|
||||
bool DIALOG_DRC_CONTROL::writeReport( const wxString& aFullFileName )
|
||||
bool DIALOG_DRC::writeReport( const wxString& aFullFileName )
|
||||
{
|
||||
FILE* fp = wxFopen( aFullFileName, wxT( "w" ) );
|
||||
|
||||
|
@ -534,7 +534,7 @@ bool DIALOG_DRC_CONTROL::writeReport( const wxString& aFullFileName )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::OnDeleteOneClick( wxCommandEvent& aEvent )
|
||||
void DIALOG_DRC::OnDeleteOneClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
if( m_Notebook->GetSelection() == 0 )
|
||||
{
|
||||
|
@ -559,7 +559,7 @@ void DIALOG_DRC_CONTROL::OnDeleteOneClick( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::OnDeleteAllClick( wxCommandEvent& aEvent )
|
||||
void DIALOG_DRC::OnDeleteAllClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
deleteAllMarkers();
|
||||
|
||||
|
@ -568,7 +568,7 @@ void DIALOG_DRC_CONTROL::OnDeleteAllClick( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_DRC_CONTROL::updateDisplayedCounts()
|
||||
void DIALOG_DRC::updateDisplayedCounts()
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
|
|
|
@ -31,32 +31,31 @@
|
|||
#include <fctsys.h>
|
||||
#include <pcbnew.h>
|
||||
#include <drc/drc.h>
|
||||
#include <rc_item.h>
|
||||
#include <class_marker_pcb.h>
|
||||
#include <class_board.h>
|
||||
#include <dialog_drc_base.h>
|
||||
#include <widgets/unit_binder.h>
|
||||
|
||||
|
||||
class DRC_ITEMS_PROVIDER;
|
||||
class BOARD_DESIGN_SETTINGS;
|
||||
class DRC_TREE_MODEL;
|
||||
|
||||
|
||||
#define DIALOG_DRC_WINDOW_NAME "DialogDrcWindowName"
|
||||
|
||||
class
|
||||
DIALOG_DRC_CONTROL: public DIALOG_DRC_CONTROL_BASE
|
||||
DIALOG_DRC: public DIALOG_DRC_BASE
|
||||
{
|
||||
public:
|
||||
BOARD_DESIGN_SETTINGS m_BrdSettings;
|
||||
|
||||
/// Constructors
|
||||
DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent );
|
||||
~DIALOG_DRC_CONTROL();
|
||||
DIALOG_DRC( DRC* aTester, PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent );
|
||||
~DIALOG_DRC();
|
||||
|
||||
void SetMarkersProvider( DRC_ITEMS_PROVIDER* aProvider );
|
||||
void SetUnconnectedProvider( DRC_ITEMS_PROVIDER* aProvider );
|
||||
void SetFootprintsProvider( DRC_ITEMS_PROVIDER* aProvider );
|
||||
void SetMarkersProvider( RC_ITEMS_PROVIDER* aProvider );
|
||||
void SetUnconnectedProvider( RC_ITEMS_PROVIDER* aProvider );
|
||||
void SetFootprintsProvider( RC_ITEMS_PROVIDER* aProvider );
|
||||
|
||||
private:
|
||||
/**
|
||||
|
@ -95,28 +94,28 @@ private:
|
|||
void deleteAllMarkers();
|
||||
void refreshBoardEditor();
|
||||
|
||||
BOARD* m_currentBoard; // the board currently on test
|
||||
DRC* m_tester;
|
||||
PCB_EDIT_FRAME* m_brdEditor;
|
||||
BOARD* m_currentBoard; // the board currently on test
|
||||
DRC* m_tester;
|
||||
PCB_EDIT_FRAME* m_brdEditor;
|
||||
|
||||
wxString m_markersTitleTemplate;
|
||||
wxString m_unconnectedTitleTemplate;
|
||||
wxString m_footprintsTitleTemplate;
|
||||
wxString m_markersTitleTemplate;
|
||||
wxString m_unconnectedTitleTemplate;
|
||||
wxString m_footprintsTitleTemplate;
|
||||
|
||||
UNIT_BINDER m_trackMinWidth;
|
||||
UNIT_BINDER m_viaMinSize;
|
||||
UNIT_BINDER m_uviaMinSize;
|
||||
UNIT_BINDER m_trackMinWidth;
|
||||
UNIT_BINDER m_viaMinSize;
|
||||
UNIT_BINDER m_uviaMinSize;
|
||||
|
||||
DRC_ITEMS_PROVIDER* m_markersProvider;
|
||||
DRC_TREE_MODEL* m_markerTreeModel;
|
||||
RC_ITEMS_PROVIDER* m_markersProvider;
|
||||
RC_TREE_MODEL* m_markerTreeModel;
|
||||
|
||||
DRC_ITEMS_PROVIDER* m_unconnectedItemsProvider;
|
||||
DRC_TREE_MODEL* m_unconnectedTreeModel;
|
||||
RC_ITEMS_PROVIDER* m_unconnectedItemsProvider;
|
||||
RC_TREE_MODEL* m_unconnectedTreeModel;
|
||||
|
||||
DRC_ITEMS_PROVIDER* m_footprintWarningsProvider;
|
||||
DRC_TREE_MODEL* m_footprintWarningsTreeModel;
|
||||
RC_ITEMS_PROVIDER* m_footprintWarningsProvider;
|
||||
RC_TREE_MODEL* m_footprintWarningsTreeModel;
|
||||
|
||||
int m_severities;
|
||||
int m_severities;
|
||||
};
|
||||
|
||||
#endif // _DIALOG_DRC_H_
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
|
@ -237,46 +237,46 @@ DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID i
|
|||
m_MainSizer->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_ACTIVATE, wxActivateEventHandler( DIALOG_DRC_CONTROL_BASE::OnActivateDlg ) );
|
||||
m_Notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_DRC_CONTROL_BASE::OnChangingNotebookPage ), NULL, this );
|
||||
m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemDClick ), NULL, this );
|
||||
m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemRClick ), NULL, this );
|
||||
m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemSelected ), NULL, this );
|
||||
m_unconnectedDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemDClick ), NULL, this );
|
||||
m_unconnectedDataView->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemSelected ), NULL, this );
|
||||
m_footprintsDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemDClick ), NULL, this );
|
||||
m_footprintsDataView->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemSelected ), NULL, this );
|
||||
m_showAll->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
|
||||
m_showErrors->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
|
||||
m_showWarnings->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
|
||||
m_showExclusions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
|
||||
m_saveReport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSaveReport ), NULL, this );
|
||||
m_DeleteCurrentMarkerButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteOneClick ), NULL, this );
|
||||
m_DeleteAllMarkersButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteAllClick ), NULL, this );
|
||||
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnCancelClick ), NULL, this );
|
||||
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnRunDRCClick ), NULL, this );
|
||||
this->Connect( wxEVT_ACTIVATE, wxActivateEventHandler( DIALOG_DRC_BASE::OnActivateDlg ) );
|
||||
m_Notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_DRC_BASE::OnChangingNotebookPage ), NULL, this );
|
||||
m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemDClick ), NULL, this );
|
||||
m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemRClick ), NULL, this );
|
||||
m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemSelected ), NULL, this );
|
||||
m_unconnectedDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemDClick ), NULL, this );
|
||||
m_unconnectedDataView->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemSelected ), NULL, this );
|
||||
m_footprintsDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemDClick ), NULL, this );
|
||||
m_footprintsDataView->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemSelected ), NULL, this );
|
||||
m_showAll->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSeverity ), NULL, this );
|
||||
m_showErrors->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSeverity ), NULL, this );
|
||||
m_showWarnings->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSeverity ), NULL, this );
|
||||
m_showExclusions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSeverity ), NULL, this );
|
||||
m_saveReport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSaveReport ), NULL, this );
|
||||
m_DeleteCurrentMarkerButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnDeleteOneClick ), NULL, this );
|
||||
m_DeleteAllMarkersButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnDeleteAllClick ), NULL, this );
|
||||
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnCancelClick ), NULL, this );
|
||||
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnRunDRCClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_DRC_CONTROL_BASE::~DIALOG_DRC_CONTROL_BASE()
|
||||
DIALOG_DRC_BASE::~DIALOG_DRC_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_ACTIVATE, wxActivateEventHandler( DIALOG_DRC_CONTROL_BASE::OnActivateDlg ) );
|
||||
m_Notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_DRC_CONTROL_BASE::OnChangingNotebookPage ), NULL, this );
|
||||
m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemDClick ), NULL, this );
|
||||
m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemRClick ), NULL, this );
|
||||
m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemSelected ), NULL, this );
|
||||
m_unconnectedDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemDClick ), NULL, this );
|
||||
m_unconnectedDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemSelected ), NULL, this );
|
||||
m_footprintsDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemDClick ), NULL, this );
|
||||
m_footprintsDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_CONTROL_BASE::OnDRCItemSelected ), NULL, this );
|
||||
m_showAll->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
|
||||
m_showErrors->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
|
||||
m_showWarnings->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
|
||||
m_showExclusions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSeverity ), NULL, this );
|
||||
m_saveReport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnSaveReport ), NULL, this );
|
||||
m_DeleteCurrentMarkerButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteOneClick ), NULL, this );
|
||||
m_DeleteAllMarkersButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnDeleteAllClick ), NULL, this );
|
||||
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnCancelClick ), NULL, this );
|
||||
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_CONTROL_BASE::OnRunDRCClick ), NULL, this );
|
||||
this->Disconnect( wxEVT_ACTIVATE, wxActivateEventHandler( DIALOG_DRC_BASE::OnActivateDlg ) );
|
||||
m_Notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_DRC_BASE::OnChangingNotebookPage ), NULL, this );
|
||||
m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemDClick ), NULL, this );
|
||||
m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemRClick ), NULL, this );
|
||||
m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemSelected ), NULL, this );
|
||||
m_unconnectedDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemDClick ), NULL, this );
|
||||
m_unconnectedDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemSelected ), NULL, this );
|
||||
m_footprintsDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemDClick ), NULL, this );
|
||||
m_footprintsDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemSelected ), NULL, this );
|
||||
m_showAll->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSeverity ), NULL, this );
|
||||
m_showErrors->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSeverity ), NULL, this );
|
||||
m_showWarnings->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSeverity ), NULL, this );
|
||||
m_showExclusions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSeverity ), NULL, this );
|
||||
m_saveReport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnSaveReport ), NULL, this );
|
||||
m_DeleteCurrentMarkerButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnDeleteOneClick ), NULL, this );
|
||||
m_DeleteAllMarkersButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnDeleteAllClick ), NULL, this );
|
||||
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnCancelClick ), NULL, this );
|
||||
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DRC_BASE::OnRunDRCClick ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">DIALOG_DRC_CONTROL_BASE</property>
|
||||
<property name="name">DIALOG_DRC_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
#define ID_NOTEBOOK1 1000
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_DRC_CONTROL_BASE
|
||||
/// Class DIALOG_DRC_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_DRC_CONTROL_BASE : public DIALOG_SHIM
|
||||
class DIALOG_DRC_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
wxPanel* m_panelUnconnectedItems;
|
||||
|
@ -98,8 +98,8 @@ class DIALOG_DRC_CONTROL_BASE : public DIALOG_SHIM
|
|||
wxTextCtrl* m_ViaMinCtrl;
|
||||
wxTextCtrl* m_uViaMinCtrl;
|
||||
|
||||
DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("DRC Control"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_DRC_CONTROL_BASE();
|
||||
DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("DRC Control"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_DRC_BASE();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <reporter.h>
|
||||
#include <bitmaps.h>
|
||||
#include <drc/drc.h>
|
||||
#include <drc/drc_item.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <class_board.h>
|
||||
|
@ -187,7 +188,7 @@ void DIALOG_NETLIST::OnTestFootprintsClick( wxCommandEvent& event )
|
|||
return;
|
||||
|
||||
HTML_MESSAGE_BOX dlg( this, _( "Check footprints" ) );
|
||||
DRC_LIST drcItems;
|
||||
std::vector<DRC_ITEM*> drcItems;
|
||||
|
||||
DRC::TestFootprints( netlist, m_parent->GetBoard(), GetUserUnits(), drcItems );
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jul 10 2019)
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -40,10 +40,10 @@ DIALOG_NETLIST_BASE::DIALOG_NETLIST_BASE( wxWindow* parent, wxWindowID id, const
|
|||
wxBoxSizer* bUpperSizer;
|
||||
bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxString m_matchByTimestampChoices[] = { _("Associate footprints using time stamp (UUID)"), _("Associate footprints using reference") };
|
||||
wxString m_matchByTimestampChoices[] = { _("Link footprints using symbol UUIDs"), _("Link footprints using symbol references") };
|
||||
int m_matchByTimestampNChoices = sizeof( m_matchByTimestampChoices ) / sizeof( wxString );
|
||||
m_matchByTimestamp = new wxRadioBox( this, wxID_ANY, _("Match Method"), wxDefaultPosition, wxDefaultSize, m_matchByTimestampNChoices, m_matchByTimestampChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_matchByTimestamp->SetSelection( 1 );
|
||||
m_matchByTimestamp = new wxRadioBox( this, wxID_ANY, _("Link Method"), wxDefaultPosition, wxDefaultSize, m_matchByTimestampNChoices, m_matchByTimestampChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_matchByTimestamp->SetSelection( 0 );
|
||||
m_matchByTimestamp->SetToolTip( _("Select whether to update footprint references to match their currently-assigned symbols, or to re-assign footprints to symbols which match their current references.") );
|
||||
|
||||
bUpperSizer->Add( m_matchByTimestamp, 1, wxALIGN_TOP|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
@ -51,19 +51,19 @@ DIALOG_NETLIST_BASE::DIALOG_NETLIST_BASE( wxWindow* parent, wxWindowID id, const
|
|||
wxStaticBoxSizer* sbSizer1;
|
||||
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL );
|
||||
|
||||
m_cbUpdateFootprints = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Update footprints"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbUpdateFootprints = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Replace footprints with those specified in netlist"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbSizer1->Add( m_cbUpdateFootprints, 0, wxBOTTOM, 5 );
|
||||
|
||||
m_cbDeleteExtraFootprints = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Delete footprints with no symbols in netlist"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbSizer1->Add( m_cbDeleteExtraFootprints, 0, wxBOTTOM, 5 );
|
||||
|
||||
m_cbDeleteShortingTracks = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Delete tracks shorting multiple nets"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbSizer1->Add( m_cbDeleteShortingTracks, 0, wxBOTTOM, 5 );
|
||||
|
||||
m_cbDeleteExtraFootprints = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Delete extra footprints"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbSizer1->Add( m_cbDeleteExtraFootprints, 0, wxBOTTOM, 5 );
|
||||
|
||||
m_cbDeleteSinglePadNets = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Delete single-pad nets"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbDeleteSinglePadNets = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Delete nets containing only a single pad"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbSizer1->Add( m_cbDeleteSinglePadNets, 0, wxBOTTOM, 5 );
|
||||
|
||||
m_cbWarnNoNetPad = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Warn for no net pads"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbWarnNoNetPad = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Generate warnings for pads with no net"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbWarnNoNetPad->SetToolTip( _("Display a warning if a pad in a footprint does not appear in netlist.\nOnly pads on a copper layer and having a name are tested.") );
|
||||
|
||||
sbSizer1->Add( m_cbWarnNoNetPad, 0, 0, 5 );
|
||||
|
@ -108,14 +108,15 @@ DIALOG_NETLIST_BASE::DIALOG_NETLIST_BASE( wxWindow* parent, wxWindowID id, const
|
|||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
bMainSizer->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
m_NetlistFilenameCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_NETLIST_BASE::OnFilenameKillFocus ), NULL, this );
|
||||
m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnOpenNetlistClick ), NULL, this );
|
||||
m_matchByTimestamp->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnMatchChanged ), NULL, this );
|
||||
m_cbUpdateFootprints->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnOptionChanged ), NULL, this );
|
||||
m_cbDeleteShortingTracks->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnOptionChanged ), NULL, this );
|
||||
m_cbDeleteExtraFootprints->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnOptionChanged ), NULL, this );
|
||||
m_cbDeleteShortingTracks->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnOptionChanged ), NULL, this );
|
||||
m_cbDeleteSinglePadNets->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnOptionChanged ), NULL, this );
|
||||
m_cbWarnNoNetPad->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnOptionChanged ), NULL, this );
|
||||
m_buttonFPTest->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnTestFootprintsClick ), NULL, this );
|
||||
|
@ -131,8 +132,8 @@ DIALOG_NETLIST_BASE::~DIALOG_NETLIST_BASE()
|
|||
m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnOpenNetlistClick ), NULL, this );
|
||||
m_matchByTimestamp->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnMatchChanged ), NULL, this );
|
||||
m_cbUpdateFootprints->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnOptionChanged ), NULL, this );
|
||||
m_cbDeleteShortingTracks->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnOptionChanged ), NULL, this );
|
||||
m_cbDeleteExtraFootprints->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnOptionChanged ), NULL, this );
|
||||
m_cbDeleteShortingTracks->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnOptionChanged ), NULL, this );
|
||||
m_cbDeleteSinglePadNets->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnOptionChanged ), NULL, this );
|
||||
m_cbWarnNoNetPad->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnOptionChanged ), NULL, this );
|
||||
m_buttonFPTest->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_BASE::OnTestFootprintsClick ), NULL, this );
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
<property name="file">dialog_netlist_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">dialog_netlist_base</property>
|
||||
|
@ -26,7 +25,6 @@
|
|||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">1</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
|
@ -47,7 +45,7 @@
|
|||
<property name="minimum_size"></property>
|
||||
<property name="name">DIALOG_NETLIST_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">499,464</property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||
<property name="title">Import Netlist</property>
|
||||
|
@ -297,7 +295,7 @@
|
|||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"Associate footprints using time stamp (UUID)" "Associate footprints using reference"</property>
|
||||
<property name="choices">"Link footprints using symbol UUIDs" "Link footprints using symbol references"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
|
@ -312,7 +310,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Match Method</property>
|
||||
<property name="label">Link Method</property>
|
||||
<property name="majorDimension">1</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
|
@ -329,7 +327,7 @@
|
|||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">1</property>
|
||||
<property name="selection">0</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxRA_SPECIFY_COLS</property>
|
||||
|
@ -391,7 +389,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Update footprints</property>
|
||||
<property name="label">Replace footprints with those specified in netlist</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
@ -423,6 +421,71 @@
|
|||
<event name="OnCheckBox">OnOptionChanged</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Delete footprints with no symbols in netlist</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_cbDeleteExtraFootprints</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnCheckBox">OnOptionChanged</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM</property>
|
||||
|
@ -521,72 +584,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Delete extra footprints</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_cbDeleteExtraFootprints</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnCheckBox">OnOptionChanged</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Delete single-pad nets</property>
|
||||
<property name="label">Delete nets containing only a single pad</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
@ -651,7 +649,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Warn for no net pads</property>
|
||||
<property name="label">Generate warnings for pads with no net</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jul 10 2019)
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -51,8 +51,8 @@ class DIALOG_NETLIST_BASE : public DIALOG_SHIM
|
|||
wxBitmapButton* m_browseButton;
|
||||
wxRadioBox* m_matchByTimestamp;
|
||||
wxCheckBox* m_cbUpdateFootprints;
|
||||
wxCheckBox* m_cbDeleteShortingTracks;
|
||||
wxCheckBox* m_cbDeleteExtraFootprints;
|
||||
wxCheckBox* m_cbDeleteShortingTracks;
|
||||
wxCheckBox* m_cbDeleteSinglePadNets;
|
||||
wxCheckBox* m_cbWarnNoNetPad;
|
||||
WX_HTML_REPORT_PANEL* m_MessageWindow;
|
||||
|
@ -76,7 +76,7 @@ class DIALOG_NETLIST_BASE : public DIALOG_SHIM
|
|||
|
||||
public:
|
||||
|
||||
DIALOG_NETLIST_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Import Netlist"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 499,464 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
DIALOG_NETLIST_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Import Netlist"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_NETLIST_BASE();
|
||||
|
||||
};
|
||||
|
|
|
@ -51,10 +51,9 @@
|
|||
#include <wx/progdlg.h>
|
||||
#include <board_commit.h>
|
||||
#include <geometry/shape_arc.h>
|
||||
|
||||
#include <drc/drc_item.h>
|
||||
#include <drc/courtyard_overlap.h>
|
||||
#include <tools/zone_filler_tool.h>
|
||||
#include "drc_tree_model.h"
|
||||
|
||||
DRC::DRC() :
|
||||
PCB_TOOL_BASE( "pcbnew.DRCTool" ),
|
||||
|
@ -127,7 +126,7 @@ void DRC::ShowDRCDialog( wxWindow* aParent )
|
|||
|
||||
if( !m_drcDialog )
|
||||
{
|
||||
m_drcDialog = new DIALOG_DRC_CONTROL( this, m_pcbEditorFrame, aParent );
|
||||
m_drcDialog = new DIALOG_DRC( this, m_pcbEditorFrame, aParent );
|
||||
updatePointers();
|
||||
|
||||
if( show_dlg_modal )
|
||||
|
@ -604,9 +603,7 @@ bool DRC::doNetClass( const NETCLASSPTR& nc, wxString& msg )
|
|||
bool DRC::testNetClasses()
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
NETCLASSES& netclasses = m_pcb->GetDesignSettings().m_NetClasses;
|
||||
|
||||
wxString msg; // construct this only once here, not in a loop, since somewhat expensive.
|
||||
|
||||
if( !doNetClass( netclasses.GetDefault(), msg ) )
|
||||
|
@ -799,15 +796,11 @@ void DRC::testUnconnected()
|
|||
|
||||
for( const auto& edge : edges )
|
||||
{
|
||||
auto src = edge.GetSourcePos();
|
||||
auto dst = edge.GetTargetPos();
|
||||
|
||||
m_unconnected.emplace_back( new DRC_ITEM( m_pcbEditorFrame->GetUserUnits(),
|
||||
DRCE_UNCONNECTED_ITEMS,
|
||||
edge.GetSourceNode()->Parent(),
|
||||
wxPoint( src.x, src.y ),
|
||||
edge.GetTargetNode()->Parent(),
|
||||
wxPoint( dst.x, dst.y ) ) );
|
||||
DRC_ITEM* item = new DRC_ITEM();
|
||||
item->SetData( m_pcbEditorFrame->GetUserUnits(), DRCE_UNCONNECTED_ITEMS,
|
||||
edge.GetSourceNode()->Parent(), (wxPoint) edge.GetSourcePos(),
|
||||
edge.GetTargetNode()->Parent(), (wxPoint) edge.GetTargetPos() );
|
||||
m_unconnected.push_back( item );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1339,11 +1332,13 @@ void DRC::doOverlappingCourtyardsDrc()
|
|||
}
|
||||
|
||||
|
||||
void DRC::TestFootprints( NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS aUnits, DRC_LIST& aDRCList )
|
||||
void DRC::TestFootprints( NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS aUnits,
|
||||
std::vector<DRC_ITEM*>& aDRCList )
|
||||
{
|
||||
|
||||
// Search for duplicate footprints on the board
|
||||
auto comp = []( const MODULE* x, const MODULE* y ) {
|
||||
auto comp = []( const MODULE* x, const MODULE* y )
|
||||
{
|
||||
return x->GetReference().CmpNoCase( y->GetReference() ) < 0;
|
||||
};
|
||||
auto mods = std::set<MODULE*, decltype( comp )>( comp );
|
||||
|
@ -1351,10 +1346,13 @@ void DRC::TestFootprints( NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS aUnits, DRC_
|
|||
for( auto mod : aPCB->Modules() )
|
||||
{
|
||||
auto ins = mods.insert( mod );
|
||||
|
||||
if( !ins.second )
|
||||
{
|
||||
aDRCList.emplace_back( new DRC_ITEM( aUnits, DRCE_DUPLICATE_FOOTPRINT, mod,
|
||||
mod->GetPosition(), *ins.first, ( *ins.first )->GetPosition() ) );
|
||||
DRC_ITEM* item = new DRC_ITEM();
|
||||
item->SetData( aUnits, DRCE_DUPLICATE_FOOTPRINT, mod, mod->GetPosition(),
|
||||
*ins.first, ( *ins.first )->GetPosition() );
|
||||
aDRCList.push_back( item );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1367,11 +1365,11 @@ void DRC::TestFootprints( NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS aUnits, DRC_
|
|||
|
||||
if( module == NULL )
|
||||
{
|
||||
wxString msg = wxString::Format( wxT( "%s (%s)" ),
|
||||
component->GetReference(),
|
||||
component->GetValue() );
|
||||
|
||||
aDRCList.emplace_back( new DRC_ITEM( DRCE_MISSING_FOOTPRINT, msg ) );
|
||||
DRC_ITEM* item = new DRC_ITEM();
|
||||
item->SetData( DRCE_MISSING_FOOTPRINT, wxString::Format( wxT( "%s (%s)" ),
|
||||
component->GetReference(),
|
||||
component->GetValue() ) );
|
||||
aDRCList.push_back( item );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1382,9 +1380,9 @@ void DRC::TestFootprints( NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS aUnits, DRC_
|
|||
|
||||
if( component == NULL )
|
||||
{
|
||||
aDRCList.emplace_back( new DRC_ITEM( aUnits, DRCE_EXTRA_FOOTPRINT,
|
||||
module, module->GetPosition(),
|
||||
nullptr, wxPoint() ) );
|
||||
DRC_ITEM* item = new DRC_ITEM();
|
||||
item->SetData( aUnits, DRCE_EXTRA_FOOTPRINT, module, module->GetPosition() );
|
||||
aDRCList.push_back( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
|
||||
|
||||
class PCB_EDIT_FRAME;
|
||||
class DIALOG_DRC_CONTROL;
|
||||
class DIALOG_DRC;
|
||||
class BOARD_ITEM;
|
||||
class BOARD;
|
||||
class D_PAD;
|
||||
|
@ -123,9 +123,6 @@ class wxString;
|
|||
class wxTextCtrl;
|
||||
|
||||
|
||||
typedef std::vector<DRC_ITEM*> DRC_LIST;
|
||||
|
||||
|
||||
/**
|
||||
* Design Rule Checker object that performs all the DRC tests. The output of
|
||||
* the checking goes to the BOARD file in the form of two MARKER lists. Those
|
||||
|
@ -136,7 +133,7 @@ typedef std::vector<DRC_ITEM*> DRC_LIST;
|
|||
*/
|
||||
class DRC : public PCB_TOOL_BASE
|
||||
{
|
||||
friend class DIALOG_DRC_CONTROL;
|
||||
friend class DIALOG_DRC;
|
||||
|
||||
public:
|
||||
DRC();
|
||||
|
@ -160,35 +157,34 @@ private:
|
|||
* to the position of the segment under test (segm to segm DRC, segm to pad DRC
|
||||
* Next variables store coordinates relative to the start point of this segment
|
||||
*/
|
||||
wxPoint m_padToTestPos; // Position of the pad to compare in drc test segm to pad or pad to pad
|
||||
wxPoint m_segmEnd; // End point of the reference segment (start point = (0,0) )
|
||||
wxPoint m_padToTestPos; // Position of the pad for segm-to-pad and pad-to-pad
|
||||
wxPoint m_segmEnd; // End point of the reference segment (start = (0, 0) )
|
||||
|
||||
/* Some functions are comparing the ref segm to pads or others segments using
|
||||
* coordinates relative to the ref segment considered as the X axis
|
||||
* so we store the ref segment length (the end point relative to these axis)
|
||||
* and the segment orientation (used to rotate other coordinates)
|
||||
*/
|
||||
double m_segmAngle; // Ref segm orientation in 0,1 degre
|
||||
int m_segmLength; // length of the reference segment
|
||||
double m_segmAngle; // Ref segm orientation in 0.1 degree
|
||||
int m_segmLength; // length of the reference segment
|
||||
|
||||
/* variables used in checkLine to test DRC segm to segm:
|
||||
* define the area relative to the ref segment that does not contains any other segment
|
||||
*/
|
||||
int m_xcliplo;
|
||||
int m_ycliplo;
|
||||
int m_xcliphi;
|
||||
int m_ycliphi;
|
||||
int m_xcliplo;
|
||||
int m_ycliplo;
|
||||
int m_xcliphi;
|
||||
int m_ycliphi;
|
||||
|
||||
PCB_EDIT_FRAME* m_pcbEditorFrame; ///< The pcb frame editor which owns the board
|
||||
BOARD* m_pcb;
|
||||
SHAPE_POLY_SET m_board_outlines; ///< The board outline including cutouts
|
||||
DIALOG_DRC_CONTROL* m_drcDialog;
|
||||
|
||||
DRC_LIST m_unconnected; ///< list of unconnected pads, as DRC_ITEMs
|
||||
DRC_LIST m_footprints; ///< list of footprint warnings, as DRC_ITEMs
|
||||
bool m_drcRun;
|
||||
bool m_footprintsTested;
|
||||
PCB_EDIT_FRAME* m_pcbEditorFrame; // The pcb frame editor which owns the board
|
||||
BOARD* m_pcb;
|
||||
SHAPE_POLY_SET m_board_outlines; // The board outline including cutouts
|
||||
DIALOG_DRC* m_drcDialog;
|
||||
|
||||
std::vector<DRC_ITEM*> m_unconnected; // list of unconnected pads
|
||||
std::vector<DRC_ITEM*> m_footprints; // list of footprint warnings
|
||||
bool m_drcRun;
|
||||
bool m_footprintsTested;
|
||||
|
||||
///> Sets up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
@ -361,8 +357,8 @@ public:
|
|||
* Test the board footprints against a netlist. Will report DRCE_MISSING_FOOTPRINT,
|
||||
* DRCE_DUPLICATE_FOOTPRINT and DRCE_EXTRA_FOOTPRINT errors in aDRCList.
|
||||
*/
|
||||
static void TestFootprints(
|
||||
NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS aUnits, DRC_LIST& aDRCList );
|
||||
static void TestFootprints( NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS aUnits,
|
||||
std::vector<DRC_ITEM*>& aDRCList );
|
||||
|
||||
/**
|
||||
* Open a dialog and prompts the user, then if a test run button is
|
||||
|
|
|
@ -28,9 +28,8 @@
|
|||
#include "wx/html/m_templ.h"
|
||||
#include "wx/html/styleparams.h"
|
||||
#include <drc/drc.h>
|
||||
#include <drc_item.h>
|
||||
#include <drc/drc_item.h>
|
||||
#include <class_board.h>
|
||||
#include <base_units.h>
|
||||
|
||||
|
||||
wxString DRC_ITEM::GetErrorText() const
|
||||
|
@ -165,81 +164,31 @@ wxString DRC_ITEM::GetErrorText() const
|
|||
}
|
||||
|
||||
|
||||
wxString DRC_ITEM::ShowCoord( EDA_UNITS aUnits, const wxPoint& aPos )
|
||||
wxString escapeHtml( wxString aString )
|
||||
{
|
||||
return wxString::Format( wxT( "@(%s, %s)" ),
|
||||
MessageTextFromValue( aUnits, aPos.x ),
|
||||
MessageTextFromValue( aUnits, aPos.y ) );
|
||||
aString.Replace( wxT("<"), wxT("<") );
|
||||
aString.Replace( wxT(">"), wxT(">") );
|
||||
return aString;
|
||||
}
|
||||
|
||||
|
||||
wxString DRC_ITEM::ShowHtml( EDA_UNITS aUnits ) const
|
||||
{
|
||||
wxString mainText = m_MainText;
|
||||
// a wxHtmlWindows does not like < and > in the text to display
|
||||
// because these chars have a special meaning in html
|
||||
mainText.Replace( wxT("<"), wxT("<") );
|
||||
mainText.Replace( wxT(">"), wxT(">") );
|
||||
|
||||
wxString errText = GetErrorText();
|
||||
errText.Replace( wxT("<"), wxT("<") );
|
||||
errText.Replace( wxT(">"), wxT(">") );
|
||||
|
||||
|
||||
if( m_hasSecondItem )
|
||||
{
|
||||
wxString auxText = m_AuxText;
|
||||
auxText.Replace( wxT("<"), wxT("<") );
|
||||
auxText.Replace( wxT(">"), wxT(">") );
|
||||
|
||||
// an html fragment for the entire message in the listbox. feel free
|
||||
// to add color if you want:
|
||||
return wxString::Format( wxT( "<b>%s</b><br> %s<br> %s" ),
|
||||
errText,
|
||||
mainText,
|
||||
auxText );
|
||||
escapeHtml( GetErrorText() ),
|
||||
escapeHtml( m_MainText ),
|
||||
escapeHtml( m_AuxText ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return wxString::Format( wxT( "<b>%s</b><br> %s" ),
|
||||
errText,
|
||||
mainText );
|
||||
escapeHtml( GetErrorText() ),
|
||||
escapeHtml( m_MainText ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxString DRC_ITEM::ShowReport( EDA_UNITS aUnits ) const
|
||||
{
|
||||
if( m_hasSecondItem )
|
||||
{
|
||||
return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n %s: %s\n" ),
|
||||
m_ErrorCode,
|
||||
GetErrorText(),
|
||||
ShowCoord( aUnits, m_MainPosition ),
|
||||
m_MainText,
|
||||
ShowCoord( aUnits, m_AuxPosition ),
|
||||
m_AuxText );
|
||||
}
|
||||
else
|
||||
{
|
||||
return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n" ),
|
||||
m_ErrorCode,
|
||||
GetErrorText(),
|
||||
ShowCoord( aUnits, m_MainPosition ),
|
||||
m_MainText );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOARD_ITEM* DRC_ITEM::GetMainItem( BOARD* aBoard ) const
|
||||
{
|
||||
return aBoard->GetItem( m_mainItemUuid );
|
||||
}
|
||||
|
||||
|
||||
BOARD_ITEM* DRC_ITEM::GetAuxiliaryItem( BOARD* aBoard ) const
|
||||
{
|
||||
return aBoard->GetItem( m_auxItemUuid );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
|
||||
* Copyright (C) 2018-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -21,62 +22,42 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef DRC_ITEM_H
|
||||
#define DRC_ITEM_H
|
||||
|
||||
#ifndef KICAD_DRC_TREE_MODEL_H
|
||||
#define KICAD_DRC_TREE_MODEL_H
|
||||
|
||||
#include <drc/drc.h>
|
||||
#include <widgets/ui_common.h>
|
||||
#include <macros.h>
|
||||
#include <base_struct.h>
|
||||
#include <rc_item.h>
|
||||
#include <marker_base.h>
|
||||
#include <class_board.h>
|
||||
#include <class_marker_pcb.h>
|
||||
#include <pcb_base_frame.h>
|
||||
|
||||
|
||||
#define WX_DATAVIEW_WINDOW_PADDING 6
|
||||
|
||||
|
||||
/**
|
||||
* Provide an abstract interface of a DRC_ITEM* list manager. The details
|
||||
* of the actual list architecture are hidden from the caller. Any class
|
||||
* that implements this interface can then be used by a DRC_TREE_MODEL class without
|
||||
* it knowing the actual architecture of the list.
|
||||
*/
|
||||
class DRC_ITEMS_PROVIDER
|
||||
class DRC_ITEM : public RC_ITEM
|
||||
{
|
||||
public:
|
||||
virtual void SetSeverities( int aSeverities ) = 0;
|
||||
|
||||
virtual int GetCount( int aSeverity = -1 ) = 0;
|
||||
/**
|
||||
* Function GetErrorText
|
||||
* returns the string form of a drc error code.
|
||||
*/
|
||||
wxString GetErrorText() const override;
|
||||
|
||||
/**
|
||||
* Function GetItem
|
||||
* retrieves a DRC_ITEM by pointer. The actual item remains owned by the
|
||||
* list container.
|
||||
* @param aIndex The 0 based index into the list of the desired item.
|
||||
* @return const DRC_ITEM* - the desired item or NULL if aIndex is out of range.
|
||||
* Function ShowHtml
|
||||
* translates this object into a fragment of HTML suitable for the wxHtmlListBox class.
|
||||
* @return wxString - the html text.
|
||||
*/
|
||||
virtual DRC_ITEM* GetItem( int aIndex ) = 0;
|
||||
|
||||
/**
|
||||
* Function DeleteItems
|
||||
* removes and deletes desired item from the list.
|
||||
* @param aIndex The 0 based index into the list of the desired item which is to be deleted.
|
||||
* @param aDeep If true, the source item should be deleted as well as the filtered item.
|
||||
*/
|
||||
virtual void DeleteItem( int aIndex, bool aDeep ) = 0;
|
||||
|
||||
/**
|
||||
* Function DeleteAllItems
|
||||
* removes and deletes all the items in the list.
|
||||
*/
|
||||
virtual void DeleteAllItems() = 0;
|
||||
|
||||
virtual ~DRC_ITEMS_PROVIDER() { }
|
||||
wxString ShowHtml( EDA_UNITS aUnits ) const;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* BOARD_DRC_ITEMS_PROVIDER
|
||||
* is an implementation of the interface named DRC_ITEM_LIST which uses a BOARD instance
|
||||
* to fulfill the interface. No ownership is taken of the BOARD.
|
||||
*/
|
||||
class BOARD_DRC_ITEMS_PROVIDER : public DRC_ITEMS_PROVIDER
|
||||
class BOARD_DRC_ITEMS_PROVIDER : public RC_ITEMS_PROVIDER
|
||||
{
|
||||
private:
|
||||
BOARD* m_board;
|
||||
|
@ -106,7 +87,7 @@ public:
|
|||
if( marker->IsExcluded() )
|
||||
markerSeverity = RPT_SEVERITY_EXCLUSION;
|
||||
else
|
||||
markerSeverity = bds.GetSeverity( marker->GetReporter().GetErrorCode() );
|
||||
markerSeverity = bds.GetSeverity( marker->GetRCItem()->GetErrorCode() );
|
||||
|
||||
if( markerSeverity & m_severities )
|
||||
m_filteredMarkers.push_back( marker );
|
||||
|
@ -118,9 +99,10 @@ public:
|
|||
if( aSeverity < 0 )
|
||||
return m_filteredMarkers.size();
|
||||
|
||||
int count = 0;
|
||||
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
|
||||
|
||||
int count = 0;
|
||||
|
||||
for( MARKER_PCB* marker : m_board->Markers() )
|
||||
{
|
||||
int markerSeverity;
|
||||
|
@ -128,7 +110,7 @@ public:
|
|||
if( marker->IsExcluded() )
|
||||
markerSeverity = RPT_SEVERITY_EXCLUSION;
|
||||
else
|
||||
markerSeverity = bds.GetSeverity( marker->GetReporter().GetErrorCode() );
|
||||
markerSeverity = bds.GetSeverity( marker->GetRCItem()->GetErrorCode() );
|
||||
|
||||
if( markerSeverity == aSeverity )
|
||||
count++;
|
||||
|
@ -141,7 +123,7 @@ public:
|
|||
{
|
||||
MARKER_PCB* marker = m_filteredMarkers[ aIndex ];
|
||||
|
||||
return marker ? &marker->GetReporter() : nullptr;
|
||||
return marker ? static_cast<DRC_ITEM*>( marker->GetRCItem() ) : nullptr;
|
||||
}
|
||||
|
||||
void DeleteItem( int aIndex, bool aDeep ) override
|
||||
|
@ -156,6 +138,7 @@ public:
|
|||
void DeleteAllItems() override
|
||||
{
|
||||
m_board->DeleteMARKERs();
|
||||
m_filteredMarkers.clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -166,7 +149,7 @@ public:
|
|||
* of pointers to DRC_ITEMs to fulfill the interface. No ownership is taken of the
|
||||
* vector.
|
||||
*/
|
||||
class VECTOR_DRC_ITEMS_PROVIDER : public DRC_ITEMS_PROVIDER
|
||||
class VECTOR_DRC_ITEMS_PROVIDER : public RC_ITEMS_PROVIDER
|
||||
{
|
||||
PCB_BASE_FRAME* m_frame;
|
||||
std::vector<DRC_ITEM*>* m_sourceVector; // owns its DRC_ITEMs
|
||||
|
@ -275,114 +258,4 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class DRC_TREE_NODE
|
||||
{
|
||||
public:
|
||||
enum NODE_TYPE { MARKER, MAIN_ITEM, AUX_ITEM };
|
||||
|
||||
DRC_TREE_NODE( DRC_TREE_NODE* aParent, DRC_ITEM* aDrcItem, NODE_TYPE aType ) :
|
||||
m_Type( aType ),
|
||||
m_Parent( aParent ),
|
||||
m_DrcItem( aDrcItem )
|
||||
{}
|
||||
|
||||
~DRC_TREE_NODE()
|
||||
{
|
||||
for( DRC_TREE_NODE* child : m_Children )
|
||||
delete child;
|
||||
}
|
||||
|
||||
NODE_TYPE m_Type;
|
||||
DRC_TREE_NODE* m_Parent;
|
||||
|
||||
DRC_ITEM* m_DrcItem;
|
||||
|
||||
std::vector<DRC_TREE_NODE*> m_Children;
|
||||
};
|
||||
|
||||
|
||||
class DRC_TREE_MODEL : public wxDataViewModel, wxEvtHandler
|
||||
{
|
||||
public:
|
||||
static wxDataViewItem ToItem( DRC_TREE_NODE const* aNode )
|
||||
{
|
||||
return wxDataViewItem( const_cast<void*>( static_cast<void const*>( aNode ) ) );
|
||||
}
|
||||
|
||||
static DRC_TREE_NODE* ToNode( wxDataViewItem aItem )
|
||||
{
|
||||
return static_cast<DRC_TREE_NODE*>( aItem.GetID() );
|
||||
}
|
||||
|
||||
static BOARD_ITEM* ToBoardItem( BOARD* aBoard, wxDataViewItem aItem );
|
||||
|
||||
public:
|
||||
DRC_TREE_MODEL( PCB_BASE_FRAME* aParentFrame, wxDataViewCtrl* aView );
|
||||
|
||||
~DRC_TREE_MODEL();
|
||||
|
||||
void SetProvider( DRC_ITEMS_PROVIDER* aProvider );
|
||||
void SetSeverities( int aSeverities );
|
||||
|
||||
int GetDRCItemCount() const { return m_tree.size(); }
|
||||
|
||||
void ExpandAll();
|
||||
|
||||
bool IsContainer( wxDataViewItem const& aItem ) const override;
|
||||
|
||||
wxDataViewItem GetParent( wxDataViewItem const& aItem ) const override;
|
||||
|
||||
unsigned int GetChildren( wxDataViewItem const& aItem,
|
||||
wxDataViewItemArray& aChildren ) const override;
|
||||
|
||||
// Simple, single-text-column model
|
||||
unsigned int GetColumnCount() const override { return 1; }
|
||||
wxString GetColumnType( unsigned int aCol ) const override { return "string"; }
|
||||
bool HasContainerColumns( wxDataViewItem const& aItem ) const override { return true; }
|
||||
|
||||
/**
|
||||
* Called by the wxDataView to fetch an item's value.
|
||||
*/
|
||||
void GetValue( wxVariant& aVariant,
|
||||
wxDataViewItem const& aItem,
|
||||
unsigned int aCol ) const override;
|
||||
|
||||
/**
|
||||
* Called by the wxDataView to edit an item's content.
|
||||
*/
|
||||
bool SetValue( wxVariant const& aVariant,
|
||||
wxDataViewItem const& aItem,
|
||||
unsigned int aCol ) override
|
||||
{
|
||||
// Editing not supported
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the wxDataView to fetch an item's formatting. Return true iff the
|
||||
* item has non-default attributes.
|
||||
*/
|
||||
bool GetAttr( wxDataViewItem const& aItem,
|
||||
unsigned int aCol,
|
||||
wxDataViewItemAttr& aAttr ) const override;
|
||||
|
||||
void ValueChanged( DRC_TREE_NODE* aNode );
|
||||
|
||||
void DeleteCurrentItem( bool aDeep );
|
||||
void DeleteAllItems();
|
||||
|
||||
private:
|
||||
void rebuildModel( DRC_ITEMS_PROVIDER* aProvider, int aSeverities );
|
||||
void onSizeView( wxSizeEvent& aEvent );
|
||||
|
||||
private:
|
||||
PCB_BASE_FRAME* m_parentFrame;
|
||||
wxDataViewCtrl* m_view;
|
||||
int m_severities;
|
||||
DRC_ITEMS_PROVIDER* m_drcItemsProvider; // I own this, but not its contents
|
||||
|
||||
std::vector<DRC_TREE_NODE*> m_tree; // I own this
|
||||
};
|
||||
|
||||
|
||||
#endif //KICAD_DRC_TREE_MODEL_H
|
||||
#endif // DRC_ITEM_H
|
|
@ -354,6 +354,14 @@ BOARD_ITEM_CONTAINER* PCB_EDIT_FRAME::GetModel() const
|
|||
}
|
||||
|
||||
|
||||
int PCB_EDIT_FRAME::GetSeverity( int aErrorCode ) const
|
||||
{
|
||||
BOARD_DESIGN_SETTINGS& bds = GetBoard()->GetDesignSettings();
|
||||
|
||||
return bds.m_DRCSeverities[ aErrorCode ];
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
|
||||
{
|
||||
PCB_BASE_FRAME::SetPageSettings( aPageSettings );
|
||||
|
@ -515,7 +523,7 @@ void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
|
|||
|
||||
// First close the DRC dialog. For some reason, if the board editor frame is destroyed
|
||||
// when the DRC dialog currently open, Pcbnew crashes, at least on Windows.
|
||||
DIALOG_DRC_CONTROL* open_dlg = static_cast<DIALOG_DRC_CONTROL*>(
|
||||
DIALOG_DRC* open_dlg = static_cast<DIALOG_DRC*>(
|
||||
wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME ) );
|
||||
|
||||
if( open_dlg )
|
||||
|
|
|
@ -672,6 +672,9 @@ public:
|
|||
///> @copydoc PCB_BASE_EDIT_FRAME::GetModel()
|
||||
BOARD_ITEM_CONTAINER* GetModel() const override;
|
||||
|
||||
///> @copydoc EDA_BASE_FRAME::GetSeverity()
|
||||
int GetSeverity( int aErrorCode ) const override;
|
||||
|
||||
///> @copydoc PCB_BASE_FRAME::SetPageSettings()
|
||||
void SetPageSettings( const PAGE_INFO& aPageSettings ) override;
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <dialog_cleanup_tracks_and_vias.h>
|
||||
#include <reporter.h>
|
||||
#include <board_commit.h>
|
||||
#include <drc/drc_item.h>
|
||||
#include <connectivity/connectivity_algo.h>
|
||||
#include <connectivity/connectivity_data.h>
|
||||
#include <tool/tool_manager.h>
|
||||
|
@ -67,8 +68,9 @@ TRACKS_CLEANER::TRACKS_CLEANER( EDA_UNITS aUnits, BOARD* aPcb, BOARD_COMMIT& aCo
|
|||
* - vias on pad
|
||||
* - null length segments
|
||||
*/
|
||||
bool TRACKS_CLEANER::CleanupBoard( bool aDryRun, DRC_LIST* aItemsList, bool aRemoveMisConnected,
|
||||
bool aCleanVias, bool aMergeSegments, bool aDeleteUnconnected, bool aDeleteTracksinPad )
|
||||
bool TRACKS_CLEANER::CleanupBoard( bool aDryRun, std::vector<DRC_ITEM*>* aItemsList,
|
||||
bool aRemoveMisConnected, bool aCleanVias, bool aMergeSegments,
|
||||
bool aDeleteUnconnected, bool aDeleteTracksinPad )
|
||||
{
|
||||
m_dryRun = aDryRun;
|
||||
m_itemsList = aItemsList;
|
||||
|
@ -131,11 +133,9 @@ bool TRACKS_CLEANER::removeBadTrackSegments()
|
|||
{
|
||||
if( segment->GetNetCode() != testedPad->GetNetCode() )
|
||||
{
|
||||
if( m_itemsList )
|
||||
{
|
||||
m_itemsList->emplace_back(
|
||||
new DRC_ITEM( m_units, DRCE_SHORT, segment, segment->GetPosition() ) );
|
||||
}
|
||||
DRC_ITEM* item = new DRC_ITEM();
|
||||
item->SetData( m_units, DRCE_SHORT, segment, segment->GetPosition() );
|
||||
m_itemsList->push_back( item );
|
||||
|
||||
toRemove.insert( segment );
|
||||
}
|
||||
|
@ -145,12 +145,9 @@ bool TRACKS_CLEANER::removeBadTrackSegments()
|
|||
{
|
||||
if( segment->GetNetCode() != testedTrack->GetNetCode() && !testedTrack->GetState( FLAG0 ) )
|
||||
{
|
||||
if( m_itemsList )
|
||||
{
|
||||
m_itemsList->emplace_back( new DRC_ITEM( m_units, DRCE_SHORT,
|
||||
segment, segment->GetPosition(),
|
||||
nullptr, wxPoint() ) );
|
||||
}
|
||||
DRC_ITEM* item = new DRC_ITEM();
|
||||
item->SetData( m_units, DRCE_SHORT, segment, segment->GetPosition() );
|
||||
m_itemsList->push_back( item );
|
||||
|
||||
toRemove.insert( segment );
|
||||
}
|
||||
|
@ -193,11 +190,10 @@ bool TRACKS_CLEANER::cleanupVias()
|
|||
|
||||
if( ( pad->GetLayerSet() & all_cu ) == all_cu )
|
||||
{
|
||||
if( m_itemsList )
|
||||
{
|
||||
m_itemsList->emplace_back( new DRC_ITEM( m_units, DRCE_REDUNDANT_VIA, via1,
|
||||
via1->GetPosition(), pad, pad->GetPosition() ) );
|
||||
}
|
||||
DRC_ITEM* item = new DRC_ITEM();
|
||||
item->SetData( m_units, DRCE_REDUNDANT_VIA, via1, via1->GetPosition(), pad,
|
||||
pad->GetPosition() );
|
||||
m_itemsList->push_back( item );
|
||||
|
||||
// redundant: delete the via
|
||||
toRemove.insert( via1 );
|
||||
|
@ -214,11 +210,10 @@ bool TRACKS_CLEANER::cleanupVias()
|
|||
|
||||
if( via1->GetViaType() == via2->GetViaType() )
|
||||
{
|
||||
if( m_itemsList )
|
||||
{
|
||||
m_itemsList->emplace_back( new DRC_ITEM( m_units, DRCE_REDUNDANT_VIA, via1,
|
||||
via1->GetPosition(), via2, via2->GetPosition() ) );
|
||||
}
|
||||
DRC_ITEM* item = new DRC_ITEM();
|
||||
item->SetData( m_units, DRCE_REDUNDANT_VIA, via1, via1->GetPosition(), via2,
|
||||
via2->GetPosition() );
|
||||
m_itemsList->push_back( item );
|
||||
|
||||
toRemove.insert( via2 );
|
||||
break;
|
||||
|
@ -314,12 +309,10 @@ bool TRACKS_CLEANER::deleteDanglingTracks()
|
|||
|
||||
if( flag_erase )
|
||||
{
|
||||
if( m_itemsList )
|
||||
{
|
||||
int code = track->IsTrack() ? DRCE_DANGLING_TRACK : DRCE_DANGLING_VIA;
|
||||
m_itemsList->emplace_back(
|
||||
new DRC_ITEM( m_units, code, track, track->GetPosition() ) );
|
||||
}
|
||||
int code = track->IsTrack() ? DRCE_DANGLING_TRACK : DRCE_DANGLING_VIA;
|
||||
DRC_ITEM* item = new DRC_ITEM();
|
||||
item->SetData( m_units, code, track, track->GetPosition() );
|
||||
m_itemsList->push_back( item );
|
||||
|
||||
if( !m_dryRun )
|
||||
{
|
||||
|
@ -350,11 +343,9 @@ bool TRACKS_CLEANER::deleteNullSegments( TRACKS& aTracks )
|
|||
{
|
||||
if( segment->IsNull() && segment->Type() == PCB_TRACE_T && !segment->IsLocked() )
|
||||
{
|
||||
if( m_itemsList )
|
||||
{
|
||||
m_itemsList->emplace_back( new DRC_ITEM(
|
||||
m_units, DRCE_ZERO_LENGTH_TRACK, segment, segment->GetPosition() ) );
|
||||
}
|
||||
DRC_ITEM* item = new DRC_ITEM();
|
||||
item->SetData( m_units, DRCE_ZERO_LENGTH_TRACK, segment, segment->GetPosition() );
|
||||
m_itemsList->push_back( item );
|
||||
|
||||
toRemove.insert( segment );
|
||||
}
|
||||
|
@ -378,11 +369,9 @@ bool TRACKS_CLEANER::deleteTracksInPads()
|
|||
{
|
||||
if( pad->HitTest( track->GetStart() ) && pad->HitTest( track->GetEnd() ) )
|
||||
{
|
||||
if( m_itemsList )
|
||||
{
|
||||
m_itemsList->emplace_back( new DRC_ITEM(
|
||||
m_units, DRCE_TRACK_IN_PAD, track, track->GetPosition() ) );
|
||||
}
|
||||
DRC_ITEM* item = new DRC_ITEM();
|
||||
item->SetData( m_units, DRCE_TRACK_IN_PAD, track, track->GetPosition() );
|
||||
m_itemsList->push_back( item );
|
||||
|
||||
toRemove.insert( track );
|
||||
}
|
||||
|
@ -420,14 +409,12 @@ bool TRACKS_CLEANER::cleanupSegments()
|
|||
|
||||
if( track1->IsPointOnEnds( track2->GetStart() )
|
||||
&& track1->IsPointOnEnds( track2->GetEnd() )
|
||||
&& ( track1->GetWidth() == track2->GetWidth() )
|
||||
&& ( track1->GetLayer() == track2->GetLayer() ) )
|
||||
&& track1->GetWidth() == track2->GetWidth()
|
||||
&& track1->GetLayer() == track2->GetLayer() )
|
||||
{
|
||||
if( m_itemsList )
|
||||
{
|
||||
m_itemsList->emplace_back( new DRC_ITEM( m_units, DRCE_DUPLICATE_TRACK, track2,
|
||||
track2->GetPosition(), nullptr, wxPoint() ) );
|
||||
}
|
||||
DRC_ITEM* item = new DRC_ITEM();
|
||||
item->SetData( m_units, DRCE_DUPLICATE_TRACK, track2, track2->GetPosition() );
|
||||
m_itemsList->push_back( item );
|
||||
|
||||
track2->SetFlags( IS_DELETED );
|
||||
toRemove.insert( track2 );
|
||||
|
@ -438,10 +425,8 @@ bool TRACKS_CLEANER::cleanupSegments()
|
|||
modified |= removeItems( toRemove );
|
||||
|
||||
// merge collinear segments:
|
||||
for( auto track_it = m_brd->Tracks().begin(); track_it != m_brd->Tracks().end(); track_it++ )
|
||||
for( TRACK* segment : m_brd->Tracks() )
|
||||
{
|
||||
auto segment = *track_it;
|
||||
|
||||
if( segment->Type() != PCB_TRACE_T ) // one can merge only track collinear segments, not vias.
|
||||
continue;
|
||||
|
||||
|
@ -527,12 +512,10 @@ bool TRACKS_CLEANER::mergeCollinearSegments( TRACK* aSeg1, TRACK* aSeg2 )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( m_itemsList )
|
||||
{
|
||||
m_itemsList->emplace_back( new DRC_ITEM( m_units, DRCE_MERGE_TRACKS,
|
||||
aSeg1, aSeg1->GetPosition(),
|
||||
aSeg2, aSeg2->GetPosition() ) );
|
||||
}
|
||||
DRC_ITEM* item = new DRC_ITEM();
|
||||
item->SetData( m_units, DRCE_MERGE_TRACKS, aSeg1, aSeg1->GetPosition(), aSeg2,
|
||||
aSeg2->GetPosition() );
|
||||
m_itemsList->push_back( item );
|
||||
|
||||
aSeg2->SetFlags( IS_DELETED );
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
* @param aDeleteTracksinPad = true to remove tracks fully inside pads
|
||||
* (short circuits)
|
||||
*/
|
||||
bool CleanupBoard( bool aDryRun, DRC_LIST* aItemsList, bool aCleanVias,
|
||||
bool CleanupBoard( bool aDryRun, std::vector<DRC_ITEM*>* aItemsList, bool aCleanVias,
|
||||
bool aRemoveMisConnected, bool aMergeSegments, bool aDeleteUnconnected,
|
||||
bool aDeleteTracksinPad );
|
||||
|
||||
|
@ -115,11 +115,11 @@ private:
|
|||
*/
|
||||
bool testTrackEndpointIsNode( TRACK* aTrack, bool aTstStart );
|
||||
|
||||
EDA_UNITS m_units;
|
||||
BOARD* m_brd;
|
||||
BOARD_COMMIT& m_commit;
|
||||
bool m_dryRun;
|
||||
DRC_LIST* m_itemsList;
|
||||
EDA_UNITS m_units;
|
||||
BOARD* m_brd;
|
||||
BOARD_COMMIT& m_commit;
|
||||
bool m_dryRun;
|
||||
std::vector<DRC_ITEM*>* m_itemsList;
|
||||
|
||||
bool removeItems( std::set<BOARD_ITEM*>& aItems );
|
||||
};
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
|
||||
std::ostream& operator<<( std::ostream& os, const MARKER_PCB& aMarker )
|
||||
{
|
||||
const auto& reporter = aMarker.GetReporter();
|
||||
const auto& reporter = aMarker.GetRCItem();
|
||||
os << "MARKER_PCB[\n";
|
||||
os << " type=" << reporter.GetErrorCode() << " (" << reporter.GetErrorText() << ")"
|
||||
os << " type=" << reporter->GetErrorCode() << " (" << reporter->GetErrorText() << ")"
|
||||
<< "\n";
|
||||
os << "]";
|
||||
return os;
|
||||
|
@ -40,7 +40,7 @@ namespace KI_TEST
|
|||
|
||||
bool IsDrcMarkerOfType( const MARKER_PCB& aMarker, int aErrorCode )
|
||||
{
|
||||
return aMarker.GetReporter().GetErrorCode() == aErrorCode;
|
||||
return aMarker.GetRCItem()->GetErrorCode() == aErrorCode;
|
||||
}
|
||||
|
||||
} // namespace KI_TEST
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <class_module.h>
|
||||
#include <drc/drc.h>
|
||||
|
||||
#include <drc/drc_item.h>
|
||||
#include <drc/courtyard_overlap.h>
|
||||
#include <widgets/ui_common.h>
|
||||
|
||||
|
@ -51,20 +51,17 @@ BOOST_FIXTURE_TEST_SUITE( DrcCourtyardInvalid, COURTYARD_TEST_FIXTURE )
|
|||
*/
|
||||
struct COURTYARD_INVALID_TEST_MODULE
|
||||
{
|
||||
/// Module Ref-Des (for identifying DRC errors)
|
||||
std::string m_refdes;
|
||||
/// List of segments that will be placed on the courtyard
|
||||
std::vector<SEG> m_segs;
|
||||
/// Module position
|
||||
VECTOR2I m_pos;
|
||||
|
||||
std::string m_refdes; /// Module Ref-Des (for identifying DRC errors)
|
||||
std::vector<SEG> m_segs; /// List of segments that will be placed on the courtyard
|
||||
VECTOR2I m_pos; /// Module position
|
||||
};
|
||||
|
||||
|
||||
struct COURTYARD_INVALID_INFO
|
||||
{
|
||||
std::string m_refdes;
|
||||
|
||||
int m_drc_error_code;
|
||||
int m_drc_error_code;
|
||||
};
|
||||
|
||||
|
||||
|
@ -78,13 +75,12 @@ std::ostream& operator<<( std::ostream& os, const COURTYARD_INVALID_INFO& aInval
|
|||
|
||||
struct COURTYARD_INVALID_CASE
|
||||
{
|
||||
std::string m_case_name;
|
||||
|
||||
std::string m_case_name;
|
||||
std::vector<COURTYARD_INVALID_TEST_MODULE> m_mods;
|
||||
|
||||
std::vector<COURTYARD_INVALID_INFO> m_exp_errors;
|
||||
std::vector<COURTYARD_INVALID_INFO> m_exp_errors;
|
||||
};
|
||||
|
||||
|
||||
// clang-format off
|
||||
static const std::vector<COURTYARD_INVALID_CASE> courtyard_invalid_cases =
|
||||
{
|
||||
|
@ -195,8 +191,8 @@ static const std::vector<COURTYARD_INVALID_CASE> courtyard_invalid_cases =
|
|||
* Construct a #MODULE to use in a courtyard test from a #COURTYARD_TEST_MODULE
|
||||
* definition.
|
||||
*/
|
||||
std::unique_ptr<MODULE> MakeInvalidCourtyardTestModule(
|
||||
BOARD& aBoard, const COURTYARD_INVALID_TEST_MODULE& aMod )
|
||||
std::unique_ptr<MODULE> MakeInvalidCourtyardTestModule( BOARD& aBoard,
|
||||
const COURTYARD_INVALID_TEST_MODULE& aMod )
|
||||
{
|
||||
auto module = std::make_unique<MODULE>( &aBoard );
|
||||
|
||||
|
@ -253,32 +249,26 @@ static BOARD_DESIGN_SETTINGS GetOverlapCheckDesignSettings()
|
|||
|
||||
|
||||
/**
|
||||
* Check if a #MARKER_PCB is described by a particular #COURTYARD_INVALID_INFO
|
||||
* object.
|
||||
* Check if a #MARKER_PCB is described by a particular #COURTYARD_INVALID_INFO object.
|
||||
*/
|
||||
static bool InvalidMatchesExpected(
|
||||
BOARD& aBoard, const MARKER_PCB& aMarker, const COURTYARD_INVALID_INFO& aInvalid )
|
||||
static bool InvalidMatchesExpected( BOARD& aBoard, const MARKER_PCB& aMarker,
|
||||
const COURTYARD_INVALID_INFO& aInvalid )
|
||||
{
|
||||
const DRC_ITEM& reporter = aMarker.GetReporter();
|
||||
|
||||
const MODULE* item_a = dynamic_cast<MODULE*>( reporter.GetMainItem( &aBoard ) );
|
||||
const DRC_ITEM* reporter = static_cast<const DRC_ITEM*>( aMarker.GetRCItem() );
|
||||
const MODULE* item_a = dynamic_cast<MODULE*>( aBoard.GetItem( reporter->GetMainItemID() ) );
|
||||
|
||||
// This one is more than just a mis-match!
|
||||
if( reporter.HasSecondItem() )
|
||||
if( reporter->HasSecondItem() )
|
||||
{
|
||||
BOOST_WARN_MESSAGE( false, "Expected no auxiliary item for invalid courtyard DRC." );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( item_a->GetReference() != aInvalid.m_refdes )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( reporter.GetErrorCode() != aInvalid.m_drc_error_code )
|
||||
{
|
||||
if( reporter->GetErrorCode() != aInvalid.m_drc_error_code )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <class_module.h>
|
||||
#include <drc/drc.h>
|
||||
|
||||
#include <drc/drc_item.h>
|
||||
#include <drc/courtyard_overlap.h>
|
||||
#include <widgets/ui_common.h>
|
||||
|
||||
|
@ -394,13 +394,13 @@ static std::vector<COURTYARD_OVERLAP_TEST_CASE> courtyard_cases = {
|
|||
* Check if a #MARKER_PCB is described by a particular #COURTYARD_COLLISION
|
||||
* object.
|
||||
*/
|
||||
static bool CollisionMatchesExpected(
|
||||
BOARD& aBoard, const MARKER_PCB& aMarker, const COURTYARD_COLLISION& aCollision )
|
||||
static bool CollisionMatchesExpected( BOARD& aBoard, const MARKER_PCB& aMarker,
|
||||
const COURTYARD_COLLISION& aCollision )
|
||||
{
|
||||
const DRC_ITEM& reporter = aMarker.GetReporter();
|
||||
const DRC_ITEM* reporter = static_cast<const DRC_ITEM*>( aMarker.GetRCItem() );
|
||||
|
||||
const MODULE* item_a = dynamic_cast<MODULE*>( reporter.GetMainItem( &aBoard ) );
|
||||
const MODULE* item_b = dynamic_cast<MODULE*>( reporter.GetAuxiliaryItem( &aBoard ) );
|
||||
const MODULE* item_a = dynamic_cast<MODULE*>( aBoard.GetItem( reporter->GetMainItemID() ) );
|
||||
const MODULE* item_b = dynamic_cast<MODULE*>( aBoard.GetItem( reporter->GetAuxItemID() ) );
|
||||
|
||||
// cant' find the items!
|
||||
if( !item_a || !item_b )
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2018 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
* Copyright (C) 2018-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -29,8 +29,6 @@
|
|||
#include <wx/cmdline.h>
|
||||
|
||||
#include <pcbnew_utils/board_file_utils.h>
|
||||
|
||||
// DRC
|
||||
#include <widgets/ui_common.h>
|
||||
#include <pcbnew/drc/drc.h>
|
||||
#include <drc/courtyard_overlap.h>
|
||||
|
@ -69,17 +67,16 @@ public:
|
|||
void Execute( BOARD& aBoard )
|
||||
{
|
||||
if( m_exec_context.m_verbose )
|
||||
{
|
||||
std::cout << "Running DRC check: " << getRunnerIntro() << std::endl;
|
||||
}
|
||||
|
||||
aBoard.SetDesignSettings( getDesignSettings() );
|
||||
|
||||
std::vector<std::unique_ptr<MARKER_PCB>> markers;
|
||||
|
||||
auto marker_handler = [&]( MARKER_PCB* aMarker ) {
|
||||
markers.push_back( std::unique_ptr<MARKER_PCB>( aMarker ) );
|
||||
};
|
||||
auto marker_handler = [&]( MARKER_PCB* aMarker )
|
||||
{
|
||||
markers.push_back( std::unique_ptr<MARKER_PCB>( aMarker ) );
|
||||
};
|
||||
|
||||
std::unique_ptr<DRC_PROVIDER> drc_prov = createDrcProvider( aBoard, marker_handler );
|
||||
|
||||
|
@ -121,15 +118,12 @@ private:
|
|||
std::cout << "DRC markers: " << aMarkers.size() << std::endl;
|
||||
|
||||
int index = 0;
|
||||
|
||||
for( const auto& m : aMarkers )
|
||||
{
|
||||
std::cout << index++ << ": " << m->GetReporter().ShowReport( EDA_UNITS::MILLIMETRES );
|
||||
}
|
||||
std::cout << index++ << ": " << m->GetRCItem()->ShowReport( EDA_UNITS::MILLIMETRES );
|
||||
|
||||
if( index )
|
||||
{
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
const EXECUTION_CONTEXT m_exec_context;
|
||||
|
@ -300,9 +294,7 @@ int drc_main_func( int argc, char** argv )
|
|||
std::string filename;
|
||||
|
||||
if( cl_parser.GetParamCount() )
|
||||
{
|
||||
filename = cl_parser.GetParam( 0 ).ToStdString();
|
||||
}
|
||||
|
||||
std::unique_ptr<BOARD> board = KI_TEST::ReadBoardFromFileOrStream( filename );
|
||||
|
||||
|
|
Loading…
Reference in New Issue