7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-14 15:19:38 +00:00

Lay some groundwork for adding distances to DRC errors.

modified:   eeschema/lib_rectangle.cpp
This commit is contained in:
Jeff Young 2020-04-24 14:36:10 +01:00
parent cb89e18281
commit 1535c83b88
134 changed files with 1395 additions and 1417 deletions
common
cvpcb
eeschema
gerbview
include
pagelayout_editor
pcbnew
qa

View File

@ -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

View File

@ -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 );
}

View File

@ -32,7 +32,6 @@
#include "fctsys.h"
#include "base_screen.h"
#include "common.h"
#include "macros.h"
#include "marker_base.h"
#include <geometry/shape_line_chain.h>
@ -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();

View File

@ -50,6 +50,7 @@
#include <fctsys.h>
#include <eda_rect.h>
#include <eda_draw_frame.h>
#include <gr_text.h>
#include <ws_draw_item.h>
#include <ws_data_model.h>
@ -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 ) );

View File

@ -26,7 +26,7 @@
#include <wx/dataview.h>
#include <widgets/ui_common.h>
#include <marker_base.h>
#include <eda_base_frame.h>
#include <eda_draw_frame.h>
#include <rc_item.h>
#include <base_units.h>
@ -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<KIID, EDA_ITEM*>& 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;
}
}

View File

@ -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<KIID, EDA_ITEM*>& 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

View File

@ -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 );
}

View File

@ -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<SCH_LINE*>( 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<SCH_JUNCTION*>( 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<SCH_NO_CONNECT*>( item ) );
}
@ -333,12 +333,13 @@ bool SCH_EDIT_FRAME::BreakSegmentsOnJunctions( SCH_SCREEN* aScreen )
bool brokenSegments = false;
std::set<wxPoint> 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<SCH_BUS_WIRE_ENTRY*>( item );
SCH_BUS_WIRE_ENTRY* entry = static_cast<SCH_BUS_WIRE_ENTRY*>( 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<SCH_LINE*> 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<SCH_LINE*>( item );
SCH_LINE* line = static_cast<SCH_LINE*>( item );
if( line->IsType( wiresAndBuses ) && line->IsEndPoint( aJunction->GetPosition() )
&& !( line->GetEditFlags() & STRUCT_DELETED ) )

View File

@ -153,13 +153,14 @@ bool CONNECTION_SUBGRAPH::ResolveDrivers( bool aCreateMarkers )
if( !same )
{
wxPoint pos = ( candidates[0]->Type() == SCH_PIN_T ) ?
static_cast<SCH_PIN*>( candidates[0] )->GetTransformedPosition() :
candidates[0]->GetPosition();
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 );
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<SCH_COMPONENT*>( 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;

View File

@ -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<KIID, EDA_ITEM*> 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<const SCH_MARKER*>( aItem );
const SCH_MARKER* marker = static_cast<const SCH_MARKER*>( 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 );
}
}

View File

@ -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 );

View File

@ -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<SCH_PIN*>( 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<SCH_PIN*>( 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<SCH_PIN*>( 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<NETLIST_OBJECT*>& 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 );
}

View File

@ -32,7 +32,7 @@
wxString ERC_ITEM::GetErrorText() const
{
switch( m_ErrorCode )
switch( m_errorCode )
{
case ERCE_UNSPECIFIED:
return wxString( _("ERC err unspecified") );

View File

@ -24,19 +24,17 @@
#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:
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<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

View File

@ -33,7 +33,7 @@
#include <msgpanel.h>
#include <bitmaps.h>
#include <math/util.h> // for KiROUND
#include <eda_draw_frame.h>
#include <general.h>
#include <lib_arc.h>
#include <transform.h>
@ -398,14 +398,14 @@ const EDA_RECT LIB_ARC::GetBoundingBox() const
}
void LIB_ARC::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
void LIB_ARC::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& 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.emplace_back( _( "Line Width" ), msg, BLUE );

View File

@ -75,7 +75,7 @@ public:
const EDA_RECT GetBoundingBox() const override;
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
int GetPenWidth() const override;
@ -87,7 +87,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;

View File

@ -29,8 +29,9 @@
#include <trigo.h>
#include <bezier_curves.h>
#include <base_units.h>
#include <eda_draw_frame.h>
#include <msgpanel.h>
#include <eda_draw_frame.h>
#include <general.h>
#include <lib_bezier.h>
#include <transform.h>
@ -330,14 +331,14 @@ const EDA_RECT LIB_BEZIER::GetBoundingBox() const
}
void LIB_BEZIER::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
void LIB_BEZIER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& 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.emplace_back( _( "Line Width" ), msg, BLUE );
@ -350,7 +351,7 @@ void LIB_BEZIER::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>&
aList.emplace_back( _( "Bounding Box" ), msg, BROWN );
}
wxPoint LIB_BEZIER::GetPosition() const
const wxPoint LIB_BEZIER::GetPosition() const
{
if( !m_PolyPoints.size() )
return wxPoint(0, 0);

View File

@ -74,7 +74,7 @@ public:
void MoveTo( const wxPoint& aPosition ) override;
wxPoint GetPosition() const override;
const wxPoint GetPosition() const override;
void MirrorHorizontal( const wxPoint& aCenter ) override;
void MirrorVertical( const wxPoint& aCenter ) override;
@ -88,7 +88,7 @@ public:
int GetPenWidth() const override;
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
EDA_ITEM* Clone() const override;

View File

@ -32,7 +32,7 @@
#include <msgpanel.h>
#include <bitmaps.h>
#include <math/util.h> // for KiROUND
#include <eda_draw_frame.h>
#include <general.h>
#include <lib_circle.h>
#include <settings/color_settings.h>
@ -240,18 +240,18 @@ const EDA_RECT LIB_CIRCLE::GetBoundingBox() const
}
void LIB_CIRCLE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
void LIB_CIRCLE::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 ) );
msg = MessageTextFromValue( aUnits, GetRadius(), true );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetRadius(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg, RED ) );
msg.Printf( wxT( "(%d, %d, %d, %d)" ),

View File

@ -59,7 +59,7 @@ public:
const EDA_RECT GetBoundingBox() const override;
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
void BeginEdit( const wxPoint aStartPoint ) override;
void CalcEdit( const wxPoint& aPosition ) override;
@ -68,7 +68,7 @@ public:
void MoveTo( const wxPoint& aPosition ) override;
wxPoint GetPosition() const override { return m_Pos; }
const wxPoint GetPosition() const override { return m_Pos; }
void SetEnd( const wxPoint& aPosition ) { m_EndPos = aPosition; }
wxPoint GetEnd() const { return m_EndPos; }

View File

@ -29,6 +29,7 @@
#include <gr_text.h>
#include <kicad_string.h>
#include <sch_draw_panel.h>
#include <eda_draw_frame.h>
#include <plotter.h>
#include <trigo.h>
#include <base_units.h>
@ -420,20 +421,20 @@ void LIB_FIELD::CalcEdit( const wxPoint& aPosition )
}
void LIB_FIELD::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
void LIB_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
wxString msg;
LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
// Display style:
msg = GetTextStyleName();
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg, MAGENTA ) );
msg = MessageTextFromValue( aUnits, GetTextWidth(), true );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, BLUE ) );
msg = MessageTextFromValue( aUnits, GetTextHeight(), true );
msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextHeight(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, BLUE ) );
// Display field name (ref, value ...)

View File

@ -151,7 +151,7 @@ public:
const EDA_RECT GetBoundingBox() const override;
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
@ -177,7 +177,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;

View File

@ -49,7 +49,7 @@ LIB_ITEM::LIB_ITEM( KICAD_T aType,
}
void LIB_ITEM::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
void LIB_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
wxString msg;

View File

@ -209,7 +209,7 @@ public:
* </p>
* @param aList is the list to populate.
*/
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& 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 ); }
/**

View File

@ -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<MSG_PANEL_ITEM>& aList,
void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& 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<MSG_PANEL_ITEM>& 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(),

Some files were not shown because too many files have changed in this diff Show More