diff --git a/common/dialogs/panel_setup_severities.cpp b/common/dialogs/panel_setup_severities.cpp
index 12e1cb3b9f..2ef6607b73 100644
--- a/common/dialogs/panel_setup_severities.cpp
+++ b/common/dialogs/panel_setup_severities.cpp
@@ -48,7 +48,7 @@ PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent, RC_ITEM&
for( int errorCode = m_firstErrorCode; errorCode <= m_lastErrorCode; ++errorCode )
{
- aDummyItem.SetData( errorCode, wxEmptyString );
+ aDummyItem.SetErrorCode( errorCode );
wxString msg = aDummyItem.GetErrorText();
// When msg is empty, for some reason, the current errorCode is not supported
diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp
index f7d18b01b3..a6b3633591 100644
--- a/common/eda_draw_frame.cpp
+++ b/common/eda_draw_frame.cpp
@@ -547,7 +547,7 @@ void EDA_DRAW_FRAME::SetMsgPanel( EDA_ITEM* aItem )
wxCHECK_RET( aItem, wxT( "Invalid EDA_ITEM pointer. Bad programmer." ) );
MSG_PANEL_ITEMS items;
- aItem->GetMsgPanelInfo( m_userUnits, items );
+ aItem->GetMsgPanelInfo( this, items );
SetMsgPanel( items );
}
diff --git a/common/marker_base.cpp b/common/marker_base.cpp
index 50481f97a6..2bf8e90a22 100644
--- a/common/marker_base.cpp
+++ b/common/marker_base.cpp
@@ -32,7 +32,6 @@
#include "fctsys.h"
#include "base_screen.h"
-#include "common.h"
#include "macros.h"
#include "marker_base.h"
#include
@@ -89,56 +88,6 @@ MARKER_BASE::~MARKER_BASE()
}
-void MARKER_BASE::SetData( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
- EDA_ITEM* aItem, const wxPoint& aPos,
- EDA_ITEM* bItem, const wxPoint& bPos )
-{
- m_Pos = aMarkerPos;
- m_rcItem->SetData( aUnits, aErrorCode, aItem, aPos, bItem, bPos );
- m_rcItem->SetParent( this );
-}
-
-
-void MARKER_BASE::SetData( int aErrorCode, const wxPoint& aMarkerPos,
- const wxString& aText, const wxPoint& aPos,
- const wxString& bText, const wxPoint& bPos )
-{
- m_Pos = aMarkerPos;
- m_rcItem->SetData( aErrorCode, aText, aPos, bText, bPos );
- m_rcItem->SetParent( this );
-}
-
-
-void MARKER_BASE::SetData( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
- EDA_ITEM* aItem,
- EDA_ITEM* bItem )
-{
- m_Pos = aMarkerPos;
- m_rcItem->SetData( aUnits, aErrorCode, aItem, bItem );
- m_rcItem->SetParent( this );
-}
-
-
-void MARKER_BASE::SetData( int aErrorCode, const wxPoint& aMarkerPos,
- const wxString& aText,
- const wxString& bText )
-{
- m_Pos = aMarkerPos;
- m_rcItem->SetData( aErrorCode, aText, bText );
- m_rcItem->SetParent( this );
-}
-
-
-void MARKER_BASE::SetData( int aErrorCode, const wxPoint& aMarkerPos,
- const wxString& aText, const KIID& aID,
- const wxString& bText, const KIID& bID )
-{
- m_Pos = aMarkerPos;
- m_rcItem->SetData( aErrorCode, aText, aID, bText, bID );
- m_rcItem->SetParent( this );
-}
-
-
bool MARKER_BASE::HitTestMarker( const wxPoint& aHitPosition, int aAccuracy ) const
{
EDA_RECT bbox = GetBoundingBoxMarker();
diff --git a/common/page_layout/ws_draw_item.cpp b/common/page_layout/ws_draw_item.cpp
index a4e6f1b973..5d7923f182 100644
--- a/common/page_layout/ws_draw_item.cpp
+++ b/common/page_layout/ws_draw_item.cpp
@@ -50,6 +50,7 @@
#include
#include
+#include
#include
#include
#include
@@ -95,7 +96,7 @@ bool WS_DRAW_ITEM_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAc
}
-void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
+void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
wxString msg;
WS_DATA_ITEM* dataItem = GetPeer();
@@ -144,8 +145,8 @@ void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aLis
aList.push_back( MSG_PANEL_ITEM( _( "Repeat Label Increment" ), msg, DARKGRAY ) );
msg.Printf( wxT( "(%s, %s)" ),
- MessageTextFromValue( aUnits, dataItem->m_IncrementVector.x ),
- MessageTextFromValue( aUnits, dataItem->m_IncrementVector.y ) );
+ MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.x ),
+ MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.y ) );
aList.push_back( MSG_PANEL_ITEM( _( "Repeat Position Increment" ), msg, RED ) );
diff --git a/common/rc_item.cpp b/common/rc_item.cpp
index 29a8575ed7..b2aaff078f 100644
--- a/common/rc_item.cpp
+++ b/common/rc_item.cpp
@@ -26,7 +26,7 @@
#include
#include
#include
-#include
+#include
#include
#include
@@ -41,25 +41,42 @@ wxString RC_ITEM::ShowCoord( EDA_UNITS aUnits, const wxPoint& aPos )
}
-wxString RC_ITEM::ShowReport( EDA_UNITS aUnits ) const
+wxString RC_ITEM::ShowReport( EDA_UNITS aUnits, const std::map& aItemMap ) const
{
- if( m_hasSecondItem )
+ EDA_ITEM* mainItem = nullptr;
+ EDA_ITEM* auxItem = nullptr;
+
+ if( m_mainItemUuid != niluuid )
+ mainItem = aItemMap.at( m_mainItemUuid );
+
+ if( m_auxItemUuid != niluuid )
+ auxItem = aItemMap.at( m_auxItemUuid );
+
+ wxString msg = m_errorMessage.IsEmpty() ? GetErrorText() : m_errorMessage;
+
+ if( mainItem && auxItem )
{
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 );
+ m_errorCode,
+ msg,
+ ShowCoord( aUnits, mainItem->GetPosition() ),
+ mainItem->GetSelectMenuText( aUnits ),
+ ShowCoord( aUnits, auxItem->GetPosition() ),
+ auxItem->GetSelectMenuText( aUnits ) );
+ }
+ else if( mainItem )
+ {
+ return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n" ),
+ m_errorCode,
+ msg,
+ ShowCoord( aUnits, mainItem->GetPosition() ),
+ mainItem->GetSelectMenuText( aUnits ) );
}
else
{
- return wxString::Format( wxT( "ErrType(%d): %s\n %s: %s\n" ),
- m_ErrorCode,
- GetErrorText(),
- ShowCoord( aUnits, m_MainPosition ),
- m_MainText );
+ return wxString::Format( wxT( "ErrType(%d): %s\n" ),
+ m_errorCode,
+ msg );
}
}
@@ -91,7 +108,7 @@ KIID RC_TREE_MODEL::ToUUID( wxDataViewItem aItem )
}
-RC_TREE_MODEL::RC_TREE_MODEL( EDA_BASE_FRAME* aParentFrame, wxDataViewCtrl* aView ) :
+RC_TREE_MODEL::RC_TREE_MODEL( EDA_DRAW_FRAME* aParentFrame, wxDataViewCtrl* aView ) :
m_editFrame( aParentFrame ),
m_view( aView ),
m_severities( 0 ),
@@ -221,8 +238,8 @@ unsigned int RC_TREE_MODEL::GetChildren( wxDataViewItem const& aItem,
* Called by the wxDataView to fetch an item's value.
*/
void RC_TREE_MODEL::GetValue( wxVariant& aVariant,
- wxDataViewItem const& aItem,
- unsigned int aCol ) const
+ wxDataViewItem const& aItem,
+ unsigned int aCol ) const
{
const RC_TREE_NODE* node = ToNode( aItem );
const RC_ITEM* rcItem = node->m_RcItem;
@@ -242,11 +259,19 @@ void RC_TREE_MODEL::GetValue( wxVariant& aVariant,
break;
case RC_TREE_NODE::MAIN_ITEM:
- aVariant = rcItem->GetMainText();
+ {
+ EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetMainItemID() );
+
+ aVariant = item->GetSelectMenuText( m_editFrame->GetUserUnits() );
+ }
break;
case RC_TREE_NODE::AUX_ITEM:
- aVariant = rcItem->GetAuxText();
+ {
+ EDA_ITEM* item = m_editFrame->GetItem( rcItem->GetAuxItemID() );
+
+ aVariant = item->GetSelectMenuText( m_editFrame->GetUserUnits() );
+ }
break;
}
}
diff --git a/common/rc_item.h b/common/rc_item.h
index 31f01ba247..178861a401 100644
--- a/common/rc_item.h
+++ b/common/rc_item.h
@@ -72,18 +72,13 @@ public:
/**
* 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.
+ * RC_ITEMs can have zero, one, or two related EDA_ITEMs.
*/
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_hasSecondItem; // true when 2 items create a DRC/ERC error
+ int m_errorCode; // the error code's numeric value
+ wxString m_errorMessage;
MARKER_BASE* m_parent; // The marker this item belongs to, if any
KIID m_mainItemUuid;
KIID m_auxItemUuid;
@@ -92,8 +87,7 @@ public:
RC_ITEM()
{
- m_ErrorCode = 0;
- m_hasSecondItem = false;
+ m_errorCode = 0;
m_parent = nullptr;
m_mainItemUuid = niluuid;
m_auxItemUuid = niluuid;
@@ -101,12 +95,8 @@ public:
RC_ITEM( RC_ITEM* aItem )
{
- 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_errorCode = aItem->m_errorCode;
+ m_errorMessage = aItem->m_errorMessage;
m_parent = aItem->m_parent;
m_mainItemUuid = aItem->m_mainItemUuid;
m_auxItemUuid = aItem->m_auxItemUuid;
@@ -114,160 +104,39 @@ public:
virtual ~RC_ITEM() { }
- /**
- * Function SetData
- * initialize all data in item
- * @param aErrorCode = error code
- * @param aMainItem = the first (main) schematic or board item
- * @param bAuxItem = the second schematic or board item
- */
- void SetData( EDA_UNITS aUnits, int aErrorCode,
- EDA_ITEM* aMainItem,
- EDA_ITEM* bAuxItem = nullptr )
- {
- m_ErrorCode = aErrorCode;
- m_MainText = aMainItem->GetSelectMenuText( aUnits );
- m_AuxText = wxEmptyString;
- m_hasSecondItem = bAuxItem != nullptr;
- m_parent = nullptr;
- m_mainItemUuid = aMainItem->m_Uuid;
+ void SetErrorMessage( const wxString& aMessage ) { m_errorMessage = aMessage; }
- if( m_hasSecondItem )
- {
- m_AuxText = bAuxItem->GetSelectMenuText( aUnits );
- m_auxItemUuid = bAuxItem->m_Uuid;
- }
+ void SetItems( EDA_ITEM* aItem, EDA_ITEM* bItem = nullptr )
+ {
+ m_mainItemUuid = aItem->m_Uuid;
+
+ if( bItem )
+ m_auxItemUuid = bItem->m_Uuid;
}
- /**
- * Function SetData
- * initialize all data in item
- * @param aErrorCode = error code
- * @param aMainItem = the first (main) schematic or board item
- * @param bAuxItem = the second schematic or board item
- * @param aMainPos = position the first item and therefore of this issue
- * @param bAuxPos = position the second item
- */
- void SetData( EDA_UNITS aUnits, int aErrorCode,
- EDA_ITEM* aMainItem, const wxPoint& aMainPos,
- EDA_ITEM* bAuxItem = nullptr, const wxPoint& bAuxPos = wxPoint() )
+ void SetItems( const KIID& aItem, const KIID& bItem = niluuid )
{
- m_ErrorCode = aErrorCode;
- m_MainText = aMainItem->GetSelectMenuText( aUnits );
- m_AuxText = wxEmptyString;
- m_MainPosition = aMainPos;
- m_AuxPosition = bAuxPos;
- m_hasSecondItem = bAuxItem != nullptr;
- m_parent = nullptr;
- m_mainItemUuid = aMainItem->m_Uuid;
-
- if( m_hasSecondItem )
- {
- m_AuxText = bAuxItem->GetSelectMenuText( aUnits );
- m_auxItemUuid = bAuxItem->m_Uuid;
- }
+ m_mainItemUuid = aItem;
+ m_auxItemUuid = bItem;
}
- /**
- * Function SetData
- * initialize all data in item
- * @param aErrorCode = error code
- * @param aMainText = a description of the first (main) item
- * @param bAuxText = a description of the second item
- */
- void SetData( int aErrorCode,
- const wxString& aMainText,
- const wxString& bAuxText = wxEmptyString )
- {
- m_ErrorCode = aErrorCode;
- m_MainText = aMainText;
- m_AuxText = bAuxText;
- m_hasSecondItem = !bAuxText.IsEmpty();
- m_parent = nullptr;
- m_mainItemUuid = niluuid;
- m_auxItemUuid = niluuid;
- }
-
- /**
- * Function SetData
- * initialize all data in item
- * @param aErrorCode = error code
- * @param aMainText = a description of the first (main) item
- * @param aMainPos = position the first item and therefore of this issue
- * @param bAuxText = a description of the second item
- * @param bAuxPos = position the second item
- */
- void SetData( int aErrorCode,
- const wxString& aMainText, const wxPoint& aMainPos,
- const wxString& bAuxText = wxEmptyString, const wxPoint& bAuxPos = wxPoint() )
- {
- m_ErrorCode = aErrorCode;
- m_MainText = aMainText;
- m_AuxText = bAuxText;
- m_MainPosition = aMainPos;
- m_AuxPosition = bAuxPos;
- m_hasSecondItem = !bAuxText.IsEmpty();
- m_parent = nullptr;
- m_mainItemUuid = niluuid;
- m_auxItemUuid = niluuid;
- }
-
- /**
- * Function SetData
- * initialize all data in item
- * @param aErrorCode = error code
- * @param aMainText = a description of the first (main) item
- * @param aMainID = UUID of the main item
- * @param bAuxText = a description of the second item
- * @param bAuxID = UUID of the second item
- */
- void SetData( int aErrorCode,
- const wxString& aMainText, const KIID& aMainID,
- const wxString& bAuxText, const KIID& bAuxID )
- {
- m_ErrorCode = aErrorCode;
- m_MainText = aMainText;
- m_AuxText = bAuxText;
- m_hasSecondItem = !bAuxText.IsEmpty() || bAuxID != niluuid;
- m_parent = nullptr;
- m_mainItemUuid = aMainID;
- m_auxItemUuid = bAuxID;
- }
-
- /**
- * Function SetAuxiliaryData
- * initialize data for the second (auxiliary) item
- * @param aAuxiliaryText = the second text (main text) concerning the second schematic
- * or board item
- * @param aAuxiliaryPos = position the second item
- */
- void SetAuxiliaryData( const wxString& aAuxiliaryText, const wxPoint& aAuxiliaryPos )
- {
- m_AuxText = aAuxiliaryText;
- m_AuxPosition = aAuxiliaryPos;
- m_hasSecondItem = true;
- m_auxItemUuid = niluuid;
- }
+ KIID GetMainItemID() const { return m_mainItemUuid; }
+ KIID GetAuxItemID() const { return m_auxItemUuid; }
void SetParent( MARKER_BASE* aMarker ) { m_parent = aMarker; }
MARKER_BASE* GetParent() const { return m_parent; }
- bool HasSecondItem() const { return m_hasSecondItem; }
-
- wxString GetMainText() const { return m_MainText; }
- wxString GetAuxText() const { return m_AuxText; }
-
- KIID GetMainItemID() const { return m_mainItemUuid; }
- KIID GetAuxItemID() const { return m_auxItemUuid; }
/**
* 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.
*/
- virtual wxString ShowReport( EDA_UNITS aUnits ) const;
+ virtual wxString ShowReport( EDA_UNITS aUnits,
+ const std::map& aItemMap ) const;
- int GetErrorCode() const { return m_ErrorCode; }
+ int GetErrorCode() const { return m_errorCode; }
+ void SetErrorCode( int aCode ) { m_errorCode = aCode; }
/**
* Function GetErrorText
@@ -325,7 +194,7 @@ public:
public:
- RC_TREE_MODEL( EDA_BASE_FRAME* aParentFrame, wxDataViewCtrl* aView );
+ RC_TREE_MODEL( EDA_DRAW_FRAME* aParentFrame, wxDataViewCtrl* aView );
~RC_TREE_MODEL();
@@ -384,7 +253,7 @@ private:
void onSizeView( wxSizeEvent& aEvent );
private:
- EDA_BASE_FRAME* m_editFrame;
+ EDA_DRAW_FRAME* m_editFrame;
wxDataViewCtrl* m_view;
int m_severities;
RC_ITEMS_PROVIDER* m_rcItemsProvider; // I own this, but not its contents
diff --git a/cvpcb/display_footprints_frame.cpp b/cvpcb/display_footprints_frame.cpp
index c7442f63eb..2e9a0cfa42 100644
--- a/cvpcb/display_footprints_frame.cpp
+++ b/cvpcb/display_footprints_frame.cpp
@@ -435,7 +435,7 @@ void DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel()
MSG_PANEL_ITEMS items;
if( footprint )
- footprint->GetMsgPanelInfo( m_userUnits, items );
+ footprint->GetMsgPanelInfo( this, items );
SetMsgPanel( items );
}
diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp
index 50f3fab048..4f5483f862 100644
--- a/eeschema/bus-wire-junction.cpp
+++ b/eeschema/bus-wire-junction.cpp
@@ -156,13 +156,13 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( SCH_SCREEN* aScreen )
BreakSegmentsOnJunctions( aScreen );
- for( auto item : aScreen->Items().OfType( SCH_LINE_T ) )
+ for( SCH_ITEM* item : aScreen->Items().OfType( SCH_LINE_T ) )
{
if( item->GetLayer() == LAYER_WIRE || item->GetLayer() == LAYER_BUS )
lines.push_back( static_cast( item ) );
}
- for( auto item : aScreen->Items().OfType( SCH_JUNCTION_T ) )
+ for( SCH_ITEM* item : aScreen->Items().OfType( SCH_JUNCTION_T ) )
{
if( !aScreen->IsJunctionNeeded( item->GetPosition() ) )
remove_item( item );
@@ -170,7 +170,7 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( SCH_SCREEN* aScreen )
junctions.push_back( static_cast( item ) );
}
- for( auto item : aScreen->Items().OfType( SCH_NO_CONNECT_T ) )
+ for( SCH_ITEM* item : aScreen->Items().OfType( SCH_NO_CONNECT_T ) )
{
ncs.push_back( static_cast( item ) );
}
@@ -333,12 +333,13 @@ bool SCH_EDIT_FRAME::BreakSegmentsOnJunctions( SCH_SCREEN* aScreen )
bool brokenSegments = false;
std::set point_set;
- for( auto item : aScreen->Items().OfType( SCH_JUNCTION_T ) )
+
+ for( SCH_ITEM* item : aScreen->Items().OfType( SCH_JUNCTION_T ) )
point_set.insert( item->GetPosition() );
- for( auto item : aScreen->Items().OfType( SCH_BUS_WIRE_ENTRY_T ) )
+ for( SCH_ITEM* item : aScreen->Items().OfType( SCH_BUS_WIRE_ENTRY_T ) )
{
- auto entry = static_cast( item );
+ SCH_BUS_WIRE_ENTRY* entry = static_cast( item );
point_set.insert( entry->GetPosition() );
point_set.insert( entry->m_End() );
}
@@ -371,9 +372,9 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
/// loop below. This will invalidate iterators in a std::vector or std::deque
std::list lines;
- for( auto item : screen->Items().Overlapping( SCH_LINE_T, aJunction->GetPosition() ) )
+ for( SCH_ITEM* item : screen->Items().Overlapping( SCH_LINE_T, aJunction->GetPosition() ) )
{
- auto line = static_cast( item );
+ SCH_LINE* line = static_cast( item );
if( line->IsType( wiresAndBuses ) && line->IsEndPoint( aJunction->GetPosition() )
&& !( line->GetEditFlags() & STRUCT_DELETED ) )
diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp
index b0464fc135..66dac4801d 100644
--- a/eeschema/connection_graph.cpp
+++ b/eeschema/connection_graph.cpp
@@ -153,13 +153,14 @@ bool CONNECTION_SUBGRAPH::ResolveDrivers( bool aCreateMarkers )
if( !same )
{
- wxPoint pos = ( candidates[0]->Type() == SCH_PIN_T ) ?
- static_cast( candidates[0] )->GetTransformedPosition() :
- candidates[0]->GetPosition();
+ wxPoint pos = candidates[0]->Type() == SCH_PIN_T ?
+ static_cast( 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 );
+ ERC_ITEM* ercItem = new ERC_ITEM( ERCE_DRIVER_CONFLICT );
+ ercItem->SetItems( candidates[0], second_item );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, pos );
m_sheet.LastScreen()->Append( marker );
// If aCreateMarkers is true, then this is part of ERC check, so we
@@ -439,7 +440,6 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet,
else if( item->Type() == SCH_COMPONENT_T )
{
SCH_COMPONENT* component = static_cast( item );
- TRANSFORM t = component->GetTransform();
// TODO(JE) right now this relies on GetSchPins() returning good SCH_PIN pointers
// that contain good LIB_PIN pointers. Since these get invalidated whenever the
@@ -452,8 +452,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet,
{
pin->InitializeConnection( aSheet );
- wxPoint pos = t.TransformCoordinate( pin->GetPosition() ) +
- component->GetPosition();
+ wxPoint pos = pin->GetPosition();
// because calling the first time is not thread-safe
pin->GetDefaultNetName( aSheet );
@@ -2006,9 +2005,10 @@ bool CONNECTION_GRAPH::ercCheckBusToNetConflicts( const CONNECTION_SUBGRAPH* aSu
if( net_item && bus_item )
{
- 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 );
+ ERC_ITEM* ercItem = new ERC_ITEM( ERCE_BUS_TO_NET_CONFLICT );
+ ercItem->SetItems( net_item, bus_item );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, net_item->GetPosition() );
screen->Append( marker );
return false;
@@ -2073,9 +2073,10 @@ bool CONNECTION_GRAPH::ercCheckBusToBusConflicts( const CONNECTION_SUBGRAPH* aSu
if( !match )
{
- auto marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
- marker->SetData( m_frame->GetUserUnits(), ERCE_BUS_TO_BUS_CONFLICT,
- label->GetPosition(), label, port );
+ ERC_ITEM* ercItem = new ERC_ITEM( ERCE_BUS_TO_BUS_CONFLICT );
+ ercItem->SetItems( label, port );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, label->GetPosition() );
screen->Append( marker );
return false;
@@ -2152,9 +2153,10 @@ bool CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts( const CONNECTION_SUBGRAPH
if( conflict )
{
- 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 );
+ ERC_ITEM* ercItem = new ERC_ITEM( ERCE_BUS_ENTRY_CONFLICT );
+ ercItem->SetItems( bus_entry, bus_wire );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, bus_entry->GetPosition() );
screen->Append( marker );
return false;
@@ -2204,9 +2206,10 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
if( pin && has_invalid_items )
{
- auto marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
- marker->SetData( ERCE_NOCONNECT_CONNECTED, pin->GetTransformedPosition(),
- pin->GetDescription( &aSubgraph->m_sheet ), pin->m_Uuid );
+ ERC_ITEM* ercItem = new ERC_ITEM( ERCE_NOCONNECT_CONNECTED );
+ ercItem->SetItems( pin );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, pin->GetTransformedPosition() );
screen->Append( marker );
return false;
@@ -2214,9 +2217,10 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
if( !has_other_items )
{
- 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 );
+ ERC_ITEM* ercItem = new ERC_ITEM( ERCE_NOCONNECT_NOT_CONNECTED );
+ ercItem->SetItems( aSubgraph->m_no_connect );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, aSubgraph->m_no_connect->GetPosition() );
screen->Append( marker );
return false;
@@ -2268,9 +2272,10 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
if( pin && !has_other_connections && pin->GetType() != ELECTRICAL_PINTYPE::PT_NC )
{
- 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 );
+ ERC_ITEM* ercItem = new ERC_ITEM( ERCE_PIN_NOT_CONNECTED );
+ ercItem->SetItems( pin );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, pin->GetTransformedPosition() );
screen->Append( marker );
return false;
@@ -2359,10 +2364,10 @@ bool CONNECTION_GRAPH::ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph )
if( !has_other_connections )
{
- 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 );
+ ERC_ITEM* ercItem = new ERC_ITEM( is_global ? ERCE_GLOBLABEL : ERCE_LABEL_NOT_CONNECTED );
+ ercItem->SetItems( text );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, text->GetPosition() );
aSubgraph->m_sheet.LastScreen()->Append( marker );
return false;
diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp
index 0d17d4ef14..062b5bc58d 100644
--- a/eeschema/dialogs/dialog_erc.cpp
+++ b/eeschema/dialogs/dialog_erc.cpp
@@ -285,14 +285,16 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter )
}
else if( pin_to_net_map[pin_name] != item->GetNetName() )
{
- msg.Printf( _( "Pin %s on %s is connected to both %s and %s" ),
+ msg.Printf( _( "Pin %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 );
+ ERC_ITEM* ercItem = new ERC_ITEM( ERCE_DIFFERENT_UNIT_NET );
+ ercItem->SetErrorMessage( msg );
+ ercItem->SetItems( item->m_Comp );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, item->m_Start );
item->m_SheetPath.LastScreen()->Append( marker );
}
}
@@ -578,18 +580,22 @@ bool DIALOG_ERC::writeReport( const wxString& aFullFileName )
wxString msg = wxString::Format( _( "ERC report (%s, Encoding UTF8)\n" ), DateAndTime() );
+ std::map itemMap;
+
int err_count = 0;
int warn_count = 0;
int total_count = 0;
SCH_SHEET_LIST sheetList( g_RootSheet );
+ sheetList.FillItemMap( itemMap );
+
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 ) )
+ for( SCH_ITEM* aItem : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
{
- auto marker = static_cast( aItem );
+ const SCH_MARKER* marker = static_cast( aItem );
if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
continue;
@@ -603,7 +609,7 @@ bool DIALOG_ERC::writeReport( const wxString& aFullFileName )
default: break;
}
- msg << marker->GetRCItem()->ShowReport( GetUserUnits() );
+ msg << marker->GetRCItem()->ShowReport( GetUserUnits(), itemMap );
}
}
diff --git a/eeschema/dialogs/dialog_schematic_setup.cpp b/eeschema/dialogs/dialog_schematic_setup.cpp
index e5a4bb1043..b61fa0a90a 100644
--- a/eeschema/dialogs/dialog_schematic_setup.cpp
+++ b/eeschema/dialogs/dialog_schematic_setup.cpp
@@ -40,7 +40,7 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
m_fieldNameTemplates = new PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( aFrame, m_treebook, false );
m_pinMap = new PANEL_SETUP_PINMAP( m_treebook, aFrame );
- ERC_ITEM dummyItem;
+ ERC_ITEM dummyItem( 0 );
m_severities = new PANEL_SETUP_SEVERITIES( this, dummyItem, g_ErcSettings->m_Severities,
ERCE_FIRST, ERCE_LAST );
diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp
index c3b8581e2e..d80cc97192 100644
--- a/eeschema/erc.cpp
+++ b/eeschema/erc.cpp
@@ -182,9 +182,10 @@ int TestDuplicateSheetNames( bool aCreateMarker )
{
if( aCreateMarker )
{
- SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
- marker->SetData( EDA_UNITS::UNSCALED, ERCE_DUPLICATE_SHEET_NAME,
- item->GetPosition(), item, test_item );
+ ERC_ITEM* ercItem = new ERC_ITEM( ERCE_DUPLICATE_SHEET_NAME );
+ ercItem->SetItems( item, test_item );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, item->GetPosition() );
screen->Append( marker );
}
@@ -214,12 +215,14 @@ void TestTextVars()
{
if( field.GetShownText().Matches( wxT( "*${*}*" ) ) )
{
- wxPoint delta = field.GetPosition() - component->GetPosition();
- delta = component->GetTransform().TransformCoordinate( delta );
+ wxPoint pos = field.GetPosition() - component->GetPosition();
+ pos = component->GetTransform().TransformCoordinate( pos );
+ pos += component->GetPosition();
- SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
- marker->SetData( EDA_UNITS::UNSCALED, ERCE_UNRESOLVED_VARIABLE,
- component->GetPosition() + delta, &field );
+ ERC_ITEM* ercItem = new ERC_ITEM( ERCE_UNRESOLVED_VARIABLE );
+ ercItem->SetItems( &field );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, pos );
screen->Append( marker );
}
}
@@ -232,9 +235,10 @@ void TestTextVars()
{
if( field.GetShownText().Matches( wxT( "*${*}*" ) ) )
{
- SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
- marker->SetData( EDA_UNITS::UNSCALED, ERCE_UNRESOLVED_VARIABLE,
- field.GetPosition(), &field );
+ ERC_ITEM* ercItem = new ERC_ITEM( ERCE_UNRESOLVED_VARIABLE );
+ ercItem->SetItems( &field );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, field.GetPosition() );
screen->Append( marker );
}
}
@@ -243,9 +247,10 @@ void TestTextVars()
{
if( pin->GetShownText().Matches( wxT( "*${*}*" ) ) )
{
- SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
- marker->SetData( EDA_UNITS::UNSCALED, ERCE_UNRESOLVED_VARIABLE,
- pin->GetPosition(), pin );
+ ERC_ITEM* ercItem = new ERC_ITEM( ERCE_UNRESOLVED_VARIABLE );
+ ercItem->SetItems( pin );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, pin->GetPosition() );
screen->Append( marker );
}
}
@@ -254,9 +259,10 @@ void TestTextVars()
{
if( text->GetShownText().Matches( wxT( "*${*}*" ) ) )
{
- SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
- marker->SetData( EDA_UNITS::UNSCALED, ERCE_UNRESOLVED_VARIABLE,
- text->GetPosition(), text );
+ ERC_ITEM* ercItem = new ERC_ITEM( ERCE_UNRESOLVED_VARIABLE );
+ ercItem->SetItems( text );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, text->GetPosition() );
screen->Append( marker );
}
}
@@ -287,8 +293,10 @@ int TestConflictingBusAliases()
alias->GetParent()->GetFileName(),
test->GetParent()->GetFileName() );
- SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
- marker->SetData( ERCE_BUS_ALIAS_CONFLICT, wxPoint(), msg );
+ ERC_ITEM* ercItem = new ERC_ITEM( ERCE_BUS_ALIAS_CONFLICT );
+ ercItem->SetErrorMessage( msg );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, wxPoint() );
test->GetParent()->Append( marker );
++err_count;
@@ -321,20 +329,19 @@ int TestMultiunitFootprints( SCH_SHEET_LIST& aSheetList )
}
// Reference footprint
- wxString fp;
- wxString unitName;
- KIID unitID;
+ SCH_COMPONENT* unit = nullptr;
+ wxString unitName;
+ wxString unitFP;
for( unsigned i = 0; i < component.second.GetCount(); ++i )
{
- SCH_COMPONENT* unit = refList.GetItem( i ).GetComp();
SCH_SHEET_PATH sheetPath = refList.GetItem( i ).GetSheetPath();
- fp = unit->GetField( FOOTPRINT )->GetText();
+ unitFP = refList.GetItem( i ).GetComp()->GetField( FOOTPRINT )->GetText();
- if( !fp.IsEmpty() )
+ if( !unitFP.IsEmpty() )
{
+ unit = refList.GetItem( i ).GetComp();
unitName = unit->GetRef( &sheetPath, true );
- unitID = unit->m_Uuid;
break;
}
}
@@ -343,20 +350,20 @@ int TestMultiunitFootprints( SCH_SHEET_LIST& aSheetList )
{
SCH_REFERENCE& secondRef = refList.GetItem( i );
SCH_COMPONENT* secondUnit = secondRef.GetComp();
- SCH_SHEET_PATH sheetPath = secondRef.GetSheetPath();
-
+ wxString secondName = secondUnit->GetRef( &secondRef.GetSheetPath(), true );
const wxString secondFp = secondUnit->GetField( FOOTPRINT )->GetText();
- wxString secondName = secondUnit->GetRef( &sheetPath, true );
- KIID secondID = secondUnit->m_Uuid;
+ wxString msg;
- if( !secondFp.IsEmpty() && fp != secondFp )
+ if( !secondFp.IsEmpty() && unitFP != secondFp )
{
- wxString description = _( "%s has '%s' assigned" );
+ msg.Printf( _( "Different footprints assigned to %s and %s" ),
+ unitName, secondName );
- 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 );
+ ERC_ITEM* ercItem = new ERC_ITEM( ERCE_DIFFERENT_UNIT_FP );
+ ercItem->SetErrorMessage( msg );
+ ercItem->SetItems( unit, secondUnit );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, secondUnit->GetPosition() );
secondRef.GetSheetPath().LastScreen()->Append( marker );
++errors;
@@ -375,28 +382,27 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst, int aMi
SCH_PIN* pin = static_cast( aNetItemRef->m_Comp );
- /* Create new marker for ERC error. */
- SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
- aNetItemRef->m_SheetPath.LastScreen()->Append( marker );
-
if( aNetItemTst == NULL)
{
if( aMinConn == NOD ) /* Nothing driving the net. */
{
- marker->SetData( ERCE_PIN_NOT_DRIVEN, aNetItemRef->m_Start,
- pin->GetDescription( &aNetItemRef->m_SheetPath ), pin->m_Uuid );
+ ERC_ITEM* ercItem = new ERC_ITEM( ERCE_PIN_NOT_DRIVEN );
+ ercItem->SetItems( pin );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, aNetItemRef->m_Start );
+ aNetItemRef->m_SheetPath.LastScreen()->Append( marker );
return;
}
}
if( aNetItemTst && aNetItemTst->m_Type == NETLIST_ITEM::PIN ) /* Error between 2 pins */
{
- SCH_PIN* pinB = static_cast( aNetItemTst->m_Comp );
+ ERC_ITEM* ercItem = new ERC_ITEM( aDiag == ERR ? ERCE_PIN_TO_PIN_ERROR
+ : ERCE_PIN_TO_PIN_WARNING );
+ ercItem->SetItems( pin, static_cast( aNetItemTst->m_Comp ) );
- 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 );
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, aNetItemRef->m_Start );
+ aNetItemRef->m_SheetPath.LastScreen()->Append( marker );
}
}
@@ -724,9 +730,9 @@ static int countIndenticalLabels( std::vector& aList, NETLIST_O
// 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_BASE::MARKER_ERC );
- marker->SetData( EDA_UNITS::UNSCALED, ERCE_SIMILAR_LABELS, aItemA->m_Start,
- aItemA->m_Comp, aItemB->m_Comp );
+ ERC_ITEM* ercItem = new ERC_ITEM( ERCE_SIMILAR_LABELS );
+ ercItem->SetItems( aItemA->m_Comp, aItemB->m_Comp );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, aItemA->m_Start );
aItemA->m_SheetPath.LastScreen()->Append( marker );
}
diff --git a/eeschema/erc_item.cpp b/eeschema/erc_item.cpp
index 8e79f42bfc..bb2ecb53e1 100644
--- a/eeschema/erc_item.cpp
+++ b/eeschema/erc_item.cpp
@@ -32,7 +32,7 @@
wxString ERC_ITEM::GetErrorText() const
{
- switch( m_ErrorCode )
+ switch( m_errorCode )
{
case ERCE_UNSPECIFIED:
return wxString( _("ERC err unspecified") );
diff --git a/eeschema/erc_item.h b/eeschema/erc_item.h
index 236db71cd5..fd6e26c4ca 100644
--- a/eeschema/erc_item.h
+++ b/eeschema/erc_item.h
@@ -24,19 +24,17 @@
#ifndef ERC_ITEM_H
#define ERC_ITEM_H
-#include
-#include
#include
-#include
-#include
-#include
-#include
-#include "erc_settings.h"
class ERC_ITEM : public RC_ITEM
{
public:
+ ERC_ITEM( int aErrorCode )
+ {
+ m_errorCode = aErrorCode;
+ }
+
/**
* Function GetErrorText
* returns the string form of a drc error code.
@@ -45,110 +43,4 @@ public:
};
-
-/**
- * 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 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( 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( 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( 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
diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp
index 433d855b04..29d7259d15 100644
--- a/eeschema/lib_arc.cpp
+++ b/eeschema/lib_arc.cpp
@@ -33,7 +33,7 @@
#include
#include
#include
* @param aList is the list to populate.
*/
- void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override;
+ void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override;
/**
* Test LIB_ITEM objects for equivalence.
@@ -245,7 +245,6 @@ public:
*/
virtual void MoveTo( const wxPoint& aPosition ) = 0;
- virtual wxPoint GetPosition() const = 0;
void SetPosition( const wxPoint& aPosition ) { MoveTo( aPosition ); }
/**
diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp
index 3e5b029ce0..010b1542b3 100644
--- a/eeschema/lib_pin.cpp
+++ b/eeschema/lib_pin.cpp
@@ -1407,11 +1407,11 @@ void LIB_PIN::SetWidth( int aWidth )
}
-void LIB_PIN::getMsgPanelInfoBase( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
+void LIB_PIN::getMsgPanelInfoBase( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
wxString text = m_number.IsEmpty() ? wxT( "?" ) : m_number;
- LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
+ LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), m_name, DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Number" ), text, DARKCYAN ) );
@@ -1424,33 +1424,35 @@ void LIB_PIN::getMsgPanelInfoBase( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), text, DARKGREEN ) );
// Display pin length
- text = StringFromValue( aUnits, m_length, true );
+ text = StringFromValue( aFrame->GetUserUnits(), m_length, true );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), text, MAGENTA ) );
text = getPinOrientationName( (unsigned) GetOrientationIndex( m_orientation ) );
aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), text, DARKMAGENTA ) );
}
-void LIB_PIN::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
+
+void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
- getMsgPanelInfoBase( aUnits, aList );
+ getMsgPanelInfoBase( aFrame, aList );
wxString text;
wxPoint pinpos = GetPosition();
pinpos.y = -pinpos.y; // Display coord are top to bottom
// lib items coord are bottom to top
- text = MessageTextFromValue( aUnits, pinpos.x, true );
+ text = MessageTextFromValue( aFrame->GetUserUnits(), pinpos.x, true );
aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) );
- text = MessageTextFromValue( aUnits, pinpos.y, true );
+ text = MessageTextFromValue( aFrame->GetUserUnits(), pinpos.y, true );
aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
}
-void LIB_PIN::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList,
+
+void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList,
SCH_COMPONENT* aComponent )
{
- getMsgPanelInfoBase( aUnits, aList );
+ getMsgPanelInfoBase( aFrame, aList );
if( !aComponent )
return;
@@ -1459,10 +1461,10 @@ void LIB_PIN::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aL
wxPoint pinpos = aComponent->GetTransform().TransformCoordinate( GetPosition() )
+ aComponent->GetPosition();
- text = MessageTextFromValue( aUnits, pinpos.x, true );
+ text = MessageTextFromValue( aFrame->GetUserUnits(), pinpos.x, true );
aList.emplace_back( _( "Pos X" ), text, DARKMAGENTA );
- text = MessageTextFromValue( aUnits, pinpos.y, true );
+ text = MessageTextFromValue( aFrame->GetUserUnits(), pinpos.y, true );
aList.emplace_back( _( "Pos Y" ), text, DARKMAGENTA );
aList.emplace_back( aComponent->GetField( REFERENCE )->GetShownText(),
diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h
index 23a4a1bb7b..32757f1baa 100644
--- a/eeschema/lib_pin.h
+++ b/eeschema/lib_pin.h
@@ -113,7 +113,7 @@ public:
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
- void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override;
+ void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override;
/**
* Display pin info (given by GetMsgPanelInfo) and add some info related to aComponent
@@ -121,8 +121,8 @@ public:
* @param aList is the message list to fill
* @param aComponent is the component which "owns" the pin
*/
- void GetMsgPanelInfo(
- EDA_UNITS aUnits, std::vector& aList, SCH_COMPONENT* aComponent );
+ void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList,
+ SCH_COMPONENT* aComponent );
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override;
@@ -427,7 +427,7 @@ public:
void MoveTo( const wxPoint& aPosition ) override;
- wxPoint GetPosition() const override { return m_position; }
+ const wxPoint GetPosition() const override { return m_position; }
/**
* move this and all linked pins to the new position
@@ -461,7 +461,7 @@ private:
* they are pin info without the actual pin position, which
* is not known in schematic without knowing the parent component
*/
- void getMsgPanelInfoBase( EDA_UNITS aUnits, std::vector& aList );
+ void getMsgPanelInfoBase( EDA_DRAW_FRAME* aFrame, std::vector& aList );
/**
diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp
index 2e80c71b9f..298018d318 100644
--- a/eeschema/lib_polyline.cpp
+++ b/eeschema/lib_polyline.cpp
@@ -26,12 +26,13 @@
#include
#include
#include
+#include
#include
#include
#include
#include
#include
-
+#include
#include
#include
#include
@@ -330,14 +331,14 @@ void LIB_POLYLINE::DeleteSegment( const wxPoint aPosition )
}
-void LIB_POLYLINE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
+void LIB_POLYLINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
wxString msg;
EDA_RECT bBox = GetBoundingBox();
- LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
+ LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
- msg = MessageTextFromValue( aUnits, m_Width, true );
+ msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
diff --git a/eeschema/lib_polyline.h b/eeschema/lib_polyline.h
index 255d61a80c..d7580a26dc 100644
--- a/eeschema/lib_polyline.h
+++ b/eeschema/lib_polyline.h
@@ -79,7 +79,7 @@ public:
int GetPenWidth() const override;
- void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override;
+ void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override;
void BeginEdit( const wxPoint aStartPoint ) override;
void CalcEdit( const wxPoint& aPosition ) override;
@@ -90,7 +90,7 @@ public:
void MoveTo( const wxPoint& aPosition ) override;
- wxPoint GetPosition() const override { return m_PolyPoints[0]; }
+ const wxPoint GetPosition() const override { return m_PolyPoints[0]; }
void MirrorHorizontal( const wxPoint& aCenter ) override;
void MirrorVertical( const wxPoint& aCenter ) override;
diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp
index d8a09e67a6..9861a16825 100644
--- a/eeschema/lib_rectangle.cpp
+++ b/eeschema/lib_rectangle.cpp
@@ -31,7 +31,7 @@
#include
#include
#include
-
+#include
#include
#include
#include
@@ -191,11 +191,11 @@ void LIB_RECTANGLE::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, v
}
-void LIB_RECTANGLE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
+void LIB_RECTANGLE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
- LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
+ LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
- wxString msg = MessageTextFromValue( aUnits, m_Width, true );
+ wxString msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
}
diff --git a/eeschema/lib_rectangle.h b/eeschema/lib_rectangle.h
index c741f6c548..6e222384c0 100644
--- a/eeschema/lib_rectangle.h
+++ b/eeschema/lib_rectangle.h
@@ -62,7 +62,7 @@ public:
const EDA_RECT GetBoundingBox() const override;
- void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override;
+ void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override;
void BeginEdit( const wxPoint aStartPoint ) override;
void CalcEdit( const wxPoint& aPosition ) override;
@@ -71,7 +71,7 @@ public:
void MoveTo( const wxPoint& aPosition ) override;
- wxPoint GetPosition() const override { return m_Pos; }
+ const wxPoint GetPosition() const override { return m_Pos; }
void MirrorHorizontal( const wxPoint& aCenter ) override;
void MirrorVertical( const wxPoint& aCenter ) override;
diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp
index 7842b62dde..e20260055e 100644
--- a/eeschema/lib_text.cpp
+++ b/eeschema/lib_text.cpp
@@ -35,7 +35,7 @@
#include
#include
#include
-
+#include
#include
#include
#include
@@ -347,11 +347,11 @@ void LIB_TEXT::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void*
}
-void LIB_TEXT::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
+void LIB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
- LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
+ LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
- wxString msg = MessageTextFromValue( aUnits, GetTextThickness(), true );
+ wxString msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextThickness(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
}
diff --git a/eeschema/lib_text.h b/eeschema/lib_text.h
index 381daadd28..026e9db791 100644
--- a/eeschema/lib_text.h
+++ b/eeschema/lib_text.h
@@ -70,7 +70,7 @@ public:
int GetPenWidth() const override;
- void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override;
+ void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override;
const EDA_RECT GetBoundingBox() const override;
@@ -81,7 +81,7 @@ public:
void MoveTo( const wxPoint& aPosition ) override;
- wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
+ const wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
void MirrorHorizontal( const wxPoint& aCenter ) override;
void MirrorVertical( const wxPoint& aCenter ) override;
diff --git a/eeschema/sch_bitmap.cpp b/eeschema/sch_bitmap.cpp
index 64c80e9b99..ee9f0d1f2a 100644
--- a/eeschema/sch_bitmap.cpp
+++ b/eeschema/sch_bitmap.cpp
@@ -34,7 +34,7 @@
#include
#include
#include
-
+#include
#include
#include
@@ -196,14 +196,14 @@ BITMAP_DEF SCH_BITMAP::GetMenuImage() const
}
-void SCH_BITMAP::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
+void SCH_BITMAP::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
aList.push_back( MSG_PANEL_ITEM( _( "Bitmap" ), wxEmptyString, RED ) );
- aList.push_back(
- MSG_PANEL_ITEM( _( "Width" ), MessageTextFromValue( aUnits, GetSize().x ), RED ) );
- aList.push_back(
- MSG_PANEL_ITEM( _( "Height" ), MessageTextFromValue( aUnits, GetSize().y ), RED ) );
+ aList.push_back( MSG_PANEL_ITEM( _( "Width" ),
+ MessageTextFromValue( aFrame->GetUserUnits(), GetSize().x ), RED ) );
+ aList.push_back( MSG_PANEL_ITEM( _( "Height" ),
+ MessageTextFromValue( aFrame->GetUserUnits(), GetSize().y ), RED ) );
}
diff --git a/eeschema/sch_bitmap.h b/eeschema/sch_bitmap.h
index f7bbdceb48..d49d38cfa7 100644
--- a/eeschema/sch_bitmap.h
+++ b/eeschema/sch_bitmap.h
@@ -135,9 +135,9 @@ public:
BITMAP_DEF GetMenuImage() const override;
- void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override;
+ void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override;
- wxPoint GetPosition() const override { return m_pos; }
+ const wxPoint GetPosition() const override { return m_pos; }
void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp
index b6becbc6df..96f42f660c 100644
--- a/eeschema/sch_bus_entry.cpp
+++ b/eeschema/sch_bus_entry.cpp
@@ -390,7 +390,7 @@ char SCH_BUS_ENTRY_BASE::GetBusEntryShape() const
}
-void SCH_BUS_ENTRY_BASE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
+void SCH_BUS_ENTRY_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
wxString msg;
diff --git a/eeschema/sch_bus_entry.h b/eeschema/sch_bus_entry.h
index 4f8623b091..d3fd8fae78 100644
--- a/eeschema/sch_bus_entry.h
+++ b/eeschema/sch_bus_entry.h
@@ -101,7 +101,7 @@ public:
void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
- wxPoint GetPosition() const override { return m_pos; }
+ const wxPoint GetPosition() const override { return m_pos; }
void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
@@ -109,7 +109,7 @@ public:
void Plot( PLOTTER* aPlotter ) override;
- void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override;
+ void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override;
bool operator <( const SCH_ITEM& aItem ) const override;
diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp
index 0b5f25b1ab..9486a8353b 100644
--- a/eeschema/sch_component.cpp
+++ b/eeschema/sch_component.cpp
@@ -1282,7 +1282,7 @@ const EDA_RECT SCH_COMPONENT::GetBoundingBox() const
}
-void SCH_COMPONENT::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
+void SCH_COMPONENT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
wxString msg;
@@ -1463,7 +1463,7 @@ bool SCH_COMPONENT::UpdateDanglingState( std::vector& aItemLi
bool previousState = pin->IsDangling();
pin->SetIsDangling( true );
- wxPoint pos = m_transform.TransformCoordinate( pin->GetPosition() ) + m_Pos;
+ wxPoint pos = m_transform.TransformCoordinate( pin->GetLocalPosition() ) + m_Pos;
for( DANGLING_END_ITEM& each_item : aItemList )
{
@@ -1528,7 +1528,7 @@ void SCH_COMPONENT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
if( pin_convert > 0 && pin_convert != GetConvert() )
continue;
- aPoints.push_back( m_transform.TransformCoordinate( pin->GetPosition() ) + m_Pos );
+ aPoints.push_back( m_transform.TransformCoordinate( pin->GetLocalPosition() ) + m_Pos );
}
}
@@ -1796,8 +1796,8 @@ bool SCH_COMPONENT::doIsConnected( const wxPoint& aPosition ) const
{
// Collect only pins attached to the current unit and convert.
// others are not associated to this component instance
- int pin_unit = pin.get()->GetLibPin()->GetUnit();
- int pin_convert = pin.get()->GetLibPin()->GetConvert();
+ int pin_unit = pin->GetLibPin()->GetUnit();
+ int pin_convert = pin->GetLibPin()->GetConvert();
if( pin_unit > 0 && pin_unit != GetUnit() )
continue;
@@ -1805,7 +1805,7 @@ bool SCH_COMPONENT::doIsConnected( const wxPoint& aPosition ) const
if( pin_convert > 0 && pin_convert != GetConvert() )
continue;
- if( pin->GetPosition() == new_pos )
+ if( pin->GetLocalPosition() == new_pos )
return true;
}
diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h
index 756cab8f78..3ea2e0c9a2 100644
--- a/eeschema/sch_component.h
+++ b/eeschema/sch_component.h
@@ -311,7 +311,7 @@ public:
*/
bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
- void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override;
+ void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override;
/**
* Clear exiting component annotation.
@@ -614,7 +614,7 @@ public:
bool IsReplaceable() const override { return true; }
- wxPoint GetPosition() const override { return m_Pos; }
+ const wxPoint GetPosition() const override { return m_Pos; }
void SetPosition( const wxPoint& aPosition ) override { Move( aPosition - m_Pos ); }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
diff --git a/eeschema/sch_eagle_plugin.cpp b/eeschema/sch_eagle_plugin.cpp
index 9c7eb30b4f..87830e6c02 100644
--- a/eeschema/sch_eagle_plugin.cpp
+++ b/eeschema/sch_eagle_plugin.cpp
@@ -2042,8 +2042,10 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
}
else
{
- SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
- marker->SetData( 0, linestart, "Bus Entry needed" );
+ ERC_ITEM* ercItem = new ERC_ITEM( 0 );
+ ercItem->SetErrorMessage( _( "Bus Entry needed" ) );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, linestart );
m_currentSheet->GetScreen()->Append( marker );
}
}
@@ -2078,8 +2080,10 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
}
else
{
- SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
- marker->SetData( 0, linestart, "Bus Entry needed" );
+ ERC_ITEM* ercItem = new ERC_ITEM( 0 );
+ ercItem->SetErrorMessage( _( "Bus Entry needed" ) );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, linestart );
m_currentSheet->GetScreen()->Append( marker );
}
}
@@ -2118,8 +2122,10 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
}
else
{
- SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
- marker->SetData( 0, lineend, "Bus Entry needed" );
+ ERC_ITEM* ercItem = new ERC_ITEM( 0 );
+ ercItem->SetErrorMessage( _( "Bus Entry needed" ) );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, lineend );
m_currentSheet->GetScreen()->Append( marker );
}
}
@@ -2153,8 +2159,10 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
}
else
{
- SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
- marker->SetData( 0, lineend, "Bus Entry needed" );
+ ERC_ITEM* ercItem = new ERC_ITEM( 0 );
+ ercItem->SetErrorMessage( _( "Bus Entry needed" ) );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, lineend );
m_currentSheet->GetScreen()->Append( marker );
}
}
@@ -2193,8 +2201,10 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
}
else
{
- SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
- marker->SetData( 0, linestart, "Bus Entry needed" );
+ ERC_ITEM* ercItem = new ERC_ITEM( 0 );
+ ercItem->SetErrorMessage( _( "Bus Entry needed" ) );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, linestart );
m_currentSheet->GetScreen()->Append( marker );
}
}
@@ -2223,8 +2233,10 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
}
else
{
- SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
- marker->SetData( 0, linestart, "Bus Entry needed" );
+ ERC_ITEM* ercItem = new ERC_ITEM( 0 );
+ ercItem->SetErrorMessage( _( "Bus Entry needed" ) );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, linestart );
m_currentSheet->GetScreen()->Append( marker );
}
}
@@ -2260,8 +2272,10 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
}
else
{
- SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
- marker->SetData( 0, lineend, "Bus Entry needed" );
+ ERC_ITEM* ercItem = new ERC_ITEM( 0 );
+ ercItem->SetErrorMessage( _( "Bus Entry needed" ) );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, lineend );
m_currentSheet->GetScreen()->Append( marker );
}
}
@@ -2290,8 +2304,10 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
}
else
{
- SCH_MARKER* marker = new SCH_MARKER( MARKER_BASE::MARKER_ERC );
- marker->SetData( 0, lineend, "Bus Entry needed" );
+ ERC_ITEM* ercItem = new ERC_ITEM( 0 );
+ ercItem->SetErrorMessage( _( "Bus Entry needed" ) );
+
+ SCH_MARKER* marker = new SCH_MARKER( ercItem, lineend );
m_currentSheet->GetScreen()->Append( marker );
}
}
diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp
index 1e4ecc4b97..57f2aba757 100644
--- a/eeschema/sch_edit_frame.cpp
+++ b/eeschema/sch_edit_frame.cpp
@@ -362,6 +362,15 @@ void SCH_EDIT_FRAME::SaveCopyForRepeatItem( SCH_ITEM* aItem )
}
+EDA_ITEM* SCH_EDIT_FRAME::GetItem( const KIID& aId )
+{
+ SCH_SHEET_LIST schematic( g_RootSheet );
+ SCH_SHEET_PATH dummy;
+
+ return schematic.GetItem( aId, &dummy );
+}
+
+
void SCH_EDIT_FRAME::SetSheetNumberAndCount()
{
SCH_SCREEN* screen;
@@ -1176,12 +1185,11 @@ void SCH_EDIT_FRAME::FixupJunctions()
for( auto aItem : screen->Items().OfType( SCH_COMPONENT_T ) )
{
- auto cmp = static_cast( aItem );
- auto xform = cmp->GetTransform();
+ auto cmp = static_cast( aItem );
for( const SCH_PIN* pin : cmp->GetSchPins( &sheet ) )
{
- auto pos = cmp->GetPosition() + xform.TransformCoordinate( pin->GetPosition() );
+ auto pos = pin->GetPosition();
// Test if a _new_ junction is needed, and add it if missing
if( screen->IsJunctionNeeded( pos, true ) )
diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h
index 7ec9043297..2156fa5ba4 100644
--- a/eeschema/sch_edit_frame.h
+++ b/eeschema/sch_edit_frame.h
@@ -915,6 +915,8 @@ public:
*/
SCH_ITEM* GetRepeatItem() const { return m_item_to_repeat; }
+ EDA_ITEM* GetItem( const KIID& aId ) override;
+
/**
* Performs an undo of the last edit WITHOUT logging a corresponding redo. Used to cancel
* an in-progress operation.
diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp
index d2e24b12cd..5fd3ad37bd 100644
--- a/eeschema/sch_field.cpp
+++ b/eeschema/sch_field.cpp
@@ -550,7 +550,7 @@ void SCH_FIELD::SetPosition( const wxPoint& aPosition )
}
-wxPoint SCH_FIELD::GetPosition() const
+const wxPoint SCH_FIELD::GetPosition() const
{
if( m_Parent && m_Parent->Type() == SCH_COMPONENT_T )
{
@@ -568,12 +568,7 @@ wxPoint SCH_FIELD::GetPosition() const
wxPoint SCH_FIELD::GetParentPosition() const
{
- if( m_Parent && m_Parent->Type() == SCH_COMPONENT_T )
- return static_cast( m_Parent )->GetPosition();
- else if( m_Parent && m_Parent->Type() == SCH_SHEET_T )
- return static_cast( m_Parent )->GetPosition();
- else
- return wxPoint();
+ return m_Parent->GetPosition();
}
diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h
index a15a109d1f..b932a40997 100644
--- a/eeschema/sch_field.h
+++ b/eeschema/sch_field.h
@@ -187,7 +187,7 @@ public:
wxPoint GetLibPosition() const { return EDA_TEXT::GetTextPos(); }
- wxPoint GetPosition() const override;
+ const wxPoint GetPosition() const override;
void SetPosition( const wxPoint& aPosition ) override;
wxPoint GetParentPosition() const;
diff --git a/eeschema/sch_item.h b/eeschema/sch_item.h
index 6ce242f02c..6d516dfafb 100644
--- a/eeschema/sch_item.h
+++ b/eeschema/sch_item.h
@@ -131,7 +131,7 @@ public:
|| ( m_pos == rhs.m_pos && m_item < rhs.m_item ) );
}
- wxPoint GetPosition() const { return m_pos; }
+ const wxPoint GetPosition() const { return m_pos; }
EDA_ITEM* GetItem() const { return m_item; }
const EDA_ITEM* GetParent() const { return m_parent; }
DANGLING_END_T GetType() const { return m_type; }
@@ -444,12 +444,6 @@ public:
virtual void GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
SCH_SHEET_PATH* aSheetPath ) { }
- /**
- * Function GetPosition
- * @return A wxPoint object containing the schematic item position.
- */
- virtual wxPoint GetPosition() const = 0;
-
/**
* Function SetPosition
* set the schematic item position to \a aPosition.
diff --git a/eeschema/sch_junction.h b/eeschema/sch_junction.h
index c85e52d119..2fc5b09ae7 100644
--- a/eeschema/sch_junction.h
+++ b/eeschema/sch_junction.h
@@ -94,7 +94,7 @@ public:
void GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems, SCH_SHEET_PATH* aSheetPath ) override;
- wxPoint GetPosition() const override { return m_pos; }
+ const wxPoint GetPosition() const override { return m_pos; }
void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp
index 75477b2f76..bb7954fa8c 100644
--- a/eeschema/sch_line.cpp
+++ b/eeschema/sch_line.cpp
@@ -767,7 +767,7 @@ void SCH_LINE::SetPosition( const wxPoint& aPosition )
}
-void SCH_LINE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
+void SCH_LINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
wxString msg;
diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h
index 184ae1fc4f..1550fa2d24 100644
--- a/eeschema/sch_line.h
+++ b/eeschema/sch_line.h
@@ -206,7 +206,7 @@ public:
bool operator <( const SCH_ITEM& aItem ) const override;
- wxPoint GetPosition() const override { return m_start; }
+ const wxPoint GetPosition() const override { return m_start; }
void SetPosition( const wxPoint& aPosition ) override;
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
@@ -218,7 +218,7 @@ public:
void SwapData( SCH_ITEM* aItem ) override;
- void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override;
+ void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override;
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const override;
diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp
index 1e58bcbf8f..cca5d8e362 100644
--- a/eeschema/sch_marker.cpp
+++ b/eeschema/sch_marker.cpp
@@ -39,10 +39,14 @@
#define SCALING_FACTOR Millimeter2iu( 0.1 )
-SCH_MARKER::SCH_MARKER( TYPEMARKER aType ) :
+SCH_MARKER::SCH_MARKER( ERC_ITEM* aItem, const wxPoint& aPos ) :
SCH_ITEM( nullptr, SCH_MARKER_T ),
- MARKER_BASE( SCALING_FACTOR, new ERC_ITEM(), aType )
+ MARKER_BASE( SCALING_FACTOR, aItem, MARKER_BASE::MARKER_ERC )
{
+ if( m_rcItem )
+ m_rcItem->SetParent( this );
+
+ m_Pos = aPos;
}
@@ -113,9 +117,7 @@ void SCH_MARKER::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
{
- return SCH_ITEM::Matches( m_rcItem->GetErrorText(), aSearchData )
- || SCH_ITEM::Matches( m_rcItem->GetMainText(), aSearchData )
- || SCH_ITEM::Matches( m_rcItem->GetAuxText(), aSearchData );
+ return SCH_ITEM::Matches( m_rcItem->GetErrorText(), aSearchData );
}
@@ -125,7 +127,7 @@ const EDA_RECT SCH_MARKER::GetBoundingBox() const
}
-void SCH_MARKER::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
+void SCH_MARKER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
aList.push_back( MSG_PANEL_ITEM( _( "Electronics Rule Check Error" ),
m_rcItem->GetErrorText(), DARKRED ) );
diff --git a/eeschema/sch_marker.h b/eeschema/sch_marker.h
index 911618b3b4..b427088460 100644
--- a/eeschema/sch_marker.h
+++ b/eeschema/sch_marker.h
@@ -25,6 +25,7 @@
#ifndef TYPE_SCH_MARKER_H_
#define TYPE_SCH_MARKER_H_
+#include
#include
#include
@@ -32,7 +33,7 @@
class SCH_MARKER : public SCH_ITEM, public MARKER_BASE
{
public:
- SCH_MARKER( TYPEMARKER aType );
+ SCH_MARKER( ERC_ITEM* aItem, const wxPoint& aPos );
// Do not create a copy constructor. The one generated by the compiler is adequate.
@@ -88,7 +89,7 @@ public:
*/
bool Matches( wxFindReplaceData& aSearchData, void* aAuxDat ) override;
- void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override;
+ void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override;
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
{
@@ -97,7 +98,7 @@ public:
BITMAP_DEF GetMenuImage() const override;
- wxPoint GetPosition() const override { return m_Pos; }
+ const wxPoint GetPosition() const override { return m_Pos; }
void SetPosition( const wxPoint& aPosition ) override { m_Pos = aPosition; }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
diff --git a/eeschema/sch_no_connect.h b/eeschema/sch_no_connect.h
index fe2d510975..dcd017cf29 100644
--- a/eeschema/sch_no_connect.h
+++ b/eeschema/sch_no_connect.h
@@ -105,7 +105,7 @@ public:
void GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems, SCH_SHEET_PATH* aSheetPath ) override;
- wxPoint GetPosition() const override { return m_pos; }
+ const wxPoint GetPosition() const override { return m_pos; }
void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
diff --git a/eeschema/sch_pin.cpp b/eeschema/sch_pin.cpp
index ad25df8a3f..c85ddb6997 100644
--- a/eeschema/sch_pin.cpp
+++ b/eeschema/sch_pin.cpp
@@ -75,27 +75,9 @@ wxString SCH_PIN::GetSelectMenuText( EDA_UNITS aUnits ) const
}
-void SCH_PIN::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
+void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
- m_libPin->GetMsgPanelInfo( aUnits, aList, GetParentComponent() );
-}
-
-
-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 ) );
- }
+ m_libPin->GetMsgPanelInfo( aFrame, aList, GetParentComponent() );
}
@@ -134,7 +116,7 @@ wxString SCH_PIN::GetDefaultNetName( const SCH_SHEET_PATH aPath )
wxPoint SCH_PIN::GetTransformedPosition() const
{
TRANSFORM t = GetParentComponent()->GetTransform();
- return ( t.TransformCoordinate( GetPosition() ) + GetParentComponent()->GetPosition() );
+ return ( t.TransformCoordinate( GetLocalPosition() ) + GetParentComponent()->GetPosition() );
}
diff --git a/eeschema/sch_pin.h b/eeschema/sch_pin.h
index 092635ec2f..60fbdd9af0 100644
--- a/eeschema/sch_pin.h
+++ b/eeschema/sch_pin.h
@@ -67,8 +67,7 @@ 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;
- wxString GetDescription( const SCH_SHEET_PATH* aSheet );
+ void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList ) override;
void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override {}
@@ -79,7 +78,8 @@ public:
void Rotate( wxPoint aPosition ) override {}
- wxPoint GetPosition() const override { return m_position; }
+ const wxPoint GetPosition() const override { return GetTransformedPosition(); }
+ const wxPoint GetLocalPosition() const { return m_position; }
void SetPosition( const wxPoint& aPosition ) override { m_position = aPosition; }
const EDA_RECT GetBoundingBox() const override;
diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp
index 27e4ff4d36..db1fa79d2e 100644
--- a/eeschema/sch_sheet.cpp
+++ b/eeschema/sch_sheet.cpp
@@ -679,7 +679,7 @@ int SCH_SHEET::CountSheets()
}
-void SCH_SHEET::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
+void SCH_SHEET::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
aList.emplace_back( _( "Sheet Name" ), m_fields[ SHEETNAME ].GetText(), CYAN );
aList.emplace_back( _( "File Name" ), m_fields[ SHEETFILENAME ].GetText(), BROWN );
diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h
index 3c9e72f506..ab3f51da57 100644
--- a/eeschema/sch_sheet.h
+++ b/eeschema/sch_sheet.h
@@ -342,7 +342,7 @@ public:
*/
bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
- void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override;
+ void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override;
/* there is no member for orientation in sch_sheet, to preserve file
* format, we detect orientation based on pin edges
@@ -568,7 +568,7 @@ public:
void ViewGetLayers( int aLayers[], int& aCount ) const override;
- wxPoint GetPosition() const override { return m_pos; }
+ const wxPoint GetPosition() const override { return m_pos; }
void SetPosition( const wxPoint& aPosition ) override;
bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override;
diff --git a/eeschema/sch_sheet_path.cpp b/eeschema/sch_sheet_path.cpp
index 19dcf97829..3479bb90c8 100644
--- a/eeschema/sch_sheet_path.cpp
+++ b/eeschema/sch_sheet_path.cpp
@@ -27,7 +27,7 @@
#include
#include
-
+#include
#include
#include
#include
@@ -36,7 +36,7 @@
#include
#include
#include
-
+#include "erc_item.h"
namespace std
{
@@ -470,6 +470,41 @@ SCH_ITEM* SCH_SHEET_LIST::GetItem( const KIID& aID, SCH_SHEET_PATH* aPathOut )
}
+SCH_ITEM* SCH_SHEET_LIST::FillItemMap( std::map& aMap )
+{
+ for( const SCH_SHEET_PATH& sheet : *this )
+ {
+ SCH_SCREEN* screen = sheet.LastScreen();
+
+ for( SCH_ITEM* aItem : screen->Items() )
+ {
+ aMap[ aItem->m_Uuid ] = aItem;
+
+ if( aItem->Type() == SCH_COMPONENT_T )
+ {
+ SCH_COMPONENT* comp = static_cast( aItem );
+
+ for( SCH_FIELD& field : comp->GetFields() )
+ aMap[ field.m_Uuid ] = &field;
+
+ for( SCH_PIN* pin : comp->GetSchPins() )
+ aMap[ pin->m_Uuid ] = pin;
+ }
+ else if( aItem->Type() == SCH_SHEET_T )
+ {
+ SCH_SHEET* sch_sheet = static_cast( aItem );
+
+ for( SCH_FIELD& field : sch_sheet->GetFields() )
+ aMap[ field.m_Uuid ] = &field;
+
+ for( SCH_SHEET_PIN* pin : sch_sheet->GetPins() )
+ aMap[ pin->m_Uuid ] = pin;
+ }
+ }
+ }
+}
+
+
void SCH_SHEET_LIST::AnnotatePowerSymbols()
{
// List of reference for power symbols
@@ -647,3 +682,95 @@ SCH_SHEET_PATH* SCH_SHEET_LIST::FindSheetForScreen( SCH_SCREEN* aScreen )
return nullptr;
}
+
+
+void SHEETLIST_ERC_ITEMS_PROVIDER::SetSeverities( int aSeverities )
+{
+ 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( 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 SHEETLIST_ERC_ITEMS_PROVIDER::GetCount( int aSeverity )
+{
+ 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( 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* SHEETLIST_ERC_ITEMS_PROVIDER::GetItem( int aIndex )
+{
+ SCH_MARKER* marker = m_filteredMarkers[ aIndex ];
+
+ return marker ? static_cast( marker->GetRCItem() ) : nullptr;
+}
+
+
+void SHEETLIST_ERC_ITEMS_PROVIDER::DeleteItem( int aIndex, bool aDeep )
+{
+ SCH_MARKER* marker = m_filteredMarkers[ aIndex ];
+ m_filteredMarkers.erase( m_filteredMarkers.begin() + aIndex );
+
+ if( aDeep )
+ {
+ SCH_SCREENS ScreenList;
+ ScreenList.DeleteMarker( marker );
+ }
+}
+
+
+void SHEETLIST_ERC_ITEMS_PROVIDER::DeleteAllItems()
+{
+ SCH_SCREENS ScreenList;
+ ScreenList.DeleteAllMarkers( MARKER_BASE::MARKER_ERC );
+ m_filteredMarkers.clear();
+}
diff --git a/eeschema/sch_sheet_path.h b/eeschema/sch_sheet_path.h
index 6862c8be71..6ee6332b85 100644
--- a/eeschema/sch_sheet_path.h
+++ b/eeschema/sch_sheet_path.h
@@ -32,6 +32,7 @@
#define CLASS_DRAWSHEET_PATH_H
#include
+#include
#include