Power Symbols: rename IsPowerConnection to IsGlobalPower

It's kind of confusing because we have power type pins, and pins that
make global power nets as part of power symbols.
This commit is contained in:
Mike Williams 2023-01-18 10:06:46 -05:00
parent dd461d6ad6
commit ca5004b1d2
7 changed files with 18 additions and 17 deletions

View File

@ -417,7 +417,7 @@ CONNECTION_SUBGRAPH::PRIORITY CONNECTION_SUBGRAPH::GetDriverPriority( SCH_ITEM*
{
SCH_PIN* sch_pin = static_cast<SCH_PIN*>( aDriver );
if( sch_pin->IsPowerConnection() )
if( sch_pin->IsGlobalPower() )
return PRIORITY::POWER_PIN;
else
return PRIORITY::PIN;
@ -561,7 +561,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet,
pin->ConnectedItems( aSheet ).clear();
// power symbol pins need to be post-processed later
if( pin->IsPowerConnection() )
if( pin->IsGlobalPower() )
m_global_power_pins.emplace_back( std::make_pair( aSheet, pin ) );
connection_map[ pos ].push_back( pin );
@ -952,7 +952,7 @@ void CONNECTION_GRAPH::collectAllDriverValues()
case SCH_PIN_T:
{
SCH_PIN* pin = static_cast<SCH_PIN*>( driver );
wxASSERT( pin->IsPowerConnection() );
wxASSERT( pin->IsGlobalPower() );
m_global_label_cache[name].push_back( subgraph );
break;
}
@ -1302,7 +1302,7 @@ void CONNECTION_GRAPH::processSubGraphs()
{
auto pin = static_cast<SCH_PIN*>( driver );
if( pin->IsPowerConnection() && pin->GetShownName() == test_name )
if( pin->IsGlobalPower() && pin->GetShownName() == test_name )
{
match = true;
break;
@ -2108,7 +2108,7 @@ std::shared_ptr<SCH_CONNECTION> CONNECTION_GRAPH::getDefaultConnection( SCH_ITEM
{
SCH_PIN* pin = static_cast<SCH_PIN*>( aItem );
if( pin->IsPowerConnection() )
if( pin->IsGlobalPower() )
c = std::make_shared<SCH_CONNECTION>( aItem, aSubgraph->m_sheet );
break;
@ -2485,7 +2485,7 @@ bool CONNECTION_GRAPH::ercCheckMultipleDrivers( const CONNECTION_SUBGRAPH* aSubg
|| driver->Type() == SCH_HIER_LABEL_T
|| driver->Type() == SCH_LABEL_T
|| ( driver->Type() == SCH_PIN_T
&& static_cast<SCH_PIN*>( driver )->IsPowerConnection() ) )
&& static_cast<SCH_PIN*>( driver )->IsGlobalPower() ) )
{
const wxString& primaryName = aSubgraph->GetNameForDriver( aSubgraph->m_driver );
const wxString& secondaryName = aSubgraph->GetNameForDriver( driver );
@ -2944,7 +2944,7 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
// We want to throw unconnected errors for power symbols even if they are connected to other
// net items by name, because usually failing to connect them graphically is a mistake
if( pin && !has_other_connections
&& pin->IsPowerConnection()
&& pin->IsGlobalPower()
&& !pin->GetLibPin()->GetParent()->IsPower() )
{
wxString name = pin->Connection( &sheet )->Name();
@ -2983,8 +2983,8 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
// pins that are meant to be dangling, but the power symbols have pins
// that are *not* meant to be dangling.
if( testPin->GetLibPin()->GetParent()->IsPower()
&& testPin->ConnectedItems( sheet ).empty()
&& settings.IsTestEnabled( ERCE_PIN_NOT_CONNECTED ) )
&& testPin->ConnectedItems( sheet ).empty()
&& settings.IsTestEnabled( ERCE_PIN_NOT_CONNECTED ) )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_PIN_NOT_CONNECTED );
ercItem->SetItems( testPin );

View File

@ -196,10 +196,11 @@ public:
bool aIncludeElectricalType ) const;
/**
* Return whether this pin forms an implicit power connection: i.e., is part of
* a power symbol and of type POWER_IN.
* Return whether this pin forms a global power connection: i.e., is part of
* a power symbol and of type POWER_IN, or is a legacy invisible global
* power pin on a symbol.
*/
bool IsPowerConnection() const
bool IsGlobalPower() const
{
return GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN
&& ( !IsVisible() || (LIB_SYMBOL*) GetParent()->IsPower() );

View File

@ -320,7 +320,7 @@ bool SCH_CONNECTION::IsDriver() const
auto pin = static_cast<SCH_PIN*>( Parent() );
// Only annotated symbols should drive nets.
return pin->IsPowerConnection() || pin->GetParentSymbol()->IsAnnotated( &m_sheet );
return pin->IsGlobalPower() || pin->GetParentSymbol()->IsAnnotated( &m_sheet );
}
default:

View File

@ -269,7 +269,7 @@ void SCH_PIN::ClearDefaultNetName( const SCH_SHEET_PATH* aPath )
wxString SCH_PIN::GetDefaultNetName( const SCH_SHEET_PATH& aPath, bool aForceNoConnect )
{
if( m_libPin->IsPowerConnection() )
if( m_libPin->IsGlobalPower() )
return EscapeString( m_libPin->GetName(), CTX_NETNAME );
std::lock_guard<std::recursive_mutex> lock( m_netmap_mutex );

View File

@ -155,7 +155,7 @@ public:
int GetLength() const;
bool IsPowerConnection() const { return m_libPin->IsPowerConnection(); }
bool IsGlobalPower() const { return m_libPin->IsGlobalPower(); }
bool ConnectionPropagatesTo( const EDA_ITEM* aItem ) const override;

View File

@ -552,7 +552,7 @@ void BACK_ANNOTATE::processNetNameChange( const wxString& aRef, SCH_PIN* aPin,
SCH_PIN* schPin = static_cast<SCH_PIN*>( driver );
TEXT_SPIN_STYLE spin = orientLabel( schPin );
if( schPin->IsPowerConnection() )
if( schPin->IsGlobalPower() )
{
msg.Printf( _( "Net %s cannot be changed to %s because it is driven by a power pin." ),
aOldName,

View File

@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE( DefaultProperties )
BOOST_CHECK( ( m_sch_pin->GetType() == m_lib_pin->GetType() ) );
BOOST_CHECK_EQUAL( m_sch_pin->IsPowerConnection(), m_lib_pin->IsPowerConnection() );
BOOST_CHECK_EQUAL( m_sch_pin->IsGlobalPower(), m_lib_pin->IsGlobalPower() );
}
/**