Finish impl of alternate pins.
It appears this got shelved while waiting for the sexpr format to be firmed up, and then I forgot about it. Fixes https://gitlab.com/kicad/code/kicad/issues/6189
This commit is contained in:
parent
ceb4b56134
commit
a6d4ce2a5c
|
@ -37,6 +37,21 @@ SCH_PIN::SCH_PIN( LIB_PIN* aLibPin, SCH_COMPONENT* aParentComponent ) :
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a proxy pin from an alternate pin designation.
|
||||
* The LIB_PIN data will be filled in when the pin is resolved (see SCH_COMPONENT::UpdatePins).
|
||||
*/
|
||||
SCH_PIN::SCH_PIN( SCH_COMPONENT* aParentComponent, const wxString& aNumber,
|
||||
const wxString& aAlt ) :
|
||||
SCH_ITEM( aParentComponent, SCH_PIN_T )
|
||||
{
|
||||
m_alt = aAlt;
|
||||
m_number = aNumber;
|
||||
m_libPin = nullptr;
|
||||
m_isDangling = true;
|
||||
}
|
||||
|
||||
|
||||
SCH_PIN::SCH_PIN( const SCH_PIN& aPin ) :
|
||||
SCH_ITEM( aPin )
|
||||
{
|
||||
|
|
|
@ -48,6 +48,8 @@ class SCH_PIN : public SCH_ITEM
|
|||
public:
|
||||
SCH_PIN( LIB_PIN* aLibPin, SCH_COMPONENT* aParentComponent );
|
||||
|
||||
SCH_PIN( SCH_COMPONENT* aParentComponent, const wxString& aNumber, const wxString& aAlt );
|
||||
|
||||
SCH_PIN( const SCH_PIN& aPin );
|
||||
|
||||
SCH_PIN& operator=( const SCH_PIN& aPin );
|
||||
|
|
|
@ -2286,17 +2286,24 @@ SCH_COMPONENT* SCH_SEXPR_PARSER::parseSchematicSymbol()
|
|||
|
||||
case T_pin:
|
||||
{
|
||||
SCH_PIN* pin = new SCH_PIN( nullptr, symbol.get() );
|
||||
// Read an alternate pin designation
|
||||
wxString number;
|
||||
wxString alt;
|
||||
|
||||
NeedSYMBOL();
|
||||
pin->SetNumber( FromUTF8() );
|
||||
number = FromUTF8();
|
||||
|
||||
token = NextTok();
|
||||
|
||||
if( token != T_LEFT )
|
||||
Expecting( T_LEFT );
|
||||
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_alternate )
|
||||
{
|
||||
NeedSYMBOL();
|
||||
pin->SetAlt( FromUTF8() );
|
||||
alt = FromUTF8();
|
||||
NeedRIGHT();
|
||||
}
|
||||
else
|
||||
|
@ -2304,7 +2311,10 @@ SCH_COMPONENT* SCH_SEXPR_PARSER::parseSchematicSymbol()
|
|||
Expecting( "alternate" );
|
||||
}
|
||||
|
||||
symbol->GetPins().push_back( pin );
|
||||
// Create a proxy pin to hold the alternate designation until the parent
|
||||
// component resolves its pins.
|
||||
symbol->GetRawPins().emplace_back( std::make_unique<SCH_PIN>( symbol.get(),
|
||||
number, alt ) );
|
||||
|
||||
NeedRIGHT();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue