Netlist/Footprints: parse fields out of netlist into footprint
The properties section duplicates all of these fields, but also contains a large amount of other cruft.
This commit is contained in:
parent
bd5d3533d8
commit
8e13f2d535
|
@ -343,20 +343,18 @@ bool BOARD_NETLIST_UPDATER::updateFootprintParameters( FOOTPRINT* aPcbFootprint,
|
|||
m_reporter->Report( msg, RPT_SEVERITY_ACTION );
|
||||
}
|
||||
|
||||
if( aPcbFootprint->GetFields() != aNetlistComponent->GetProperties() )
|
||||
if( aPcbFootprint->GetFields() != aNetlistComponent->GetFields() )
|
||||
{
|
||||
if( m_isDryRun )
|
||||
{
|
||||
msg.Printf( _( "Update %s properties." ),
|
||||
aPcbFootprint->GetReference() );
|
||||
msg.Printf( _( "Update %s fields." ), aPcbFootprint->GetReference() );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( _( "Updated %s properties." ),
|
||||
aPcbFootprint->GetReference() );
|
||||
msg.Printf( _( "Updated %s fields." ), aPcbFootprint->GetReference() );
|
||||
|
||||
changed = true;
|
||||
aPcbFootprint->SetFields( aNetlistComponent->GetProperties() );
|
||||
aPcbFootprint->SetFields( aNetlistComponent->GetFields() );
|
||||
}
|
||||
|
||||
m_reporter->Report( msg, RPT_SEVERITY_ACTION );
|
||||
|
|
|
@ -310,6 +310,7 @@ void KICAD_NETLIST_PARSER::parseComponent()
|
|||
|
||||
std::vector<KIID> uuids;
|
||||
std::map<wxString, wxString> properties;
|
||||
std::map<wxString, wxString> fields;
|
||||
|
||||
// The token comp was read, so the next data is (ref P1)
|
||||
while( (token = NextTok() ) != T_RIGHT )
|
||||
|
@ -401,6 +402,46 @@ void KICAD_NETLIST_PARSER::parseComponent()
|
|||
}
|
||||
break;
|
||||
|
||||
case T_fields:
|
||||
|
||||
// Read fields
|
||||
while( ( token = NextTok() ) != T_RIGHT )
|
||||
{
|
||||
if( token == T_LEFT )
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_field )
|
||||
{
|
||||
wxString fieldName;
|
||||
wxString fieldValue;
|
||||
|
||||
while( ( token = NextTok() ) != T_RIGHT )
|
||||
{
|
||||
if( token == T_LEFT )
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_name )
|
||||
{
|
||||
NeedSYMBOLorNUMBER();
|
||||
fieldName = FROM_UTF8( CurText() );
|
||||
NeedRIGHT();
|
||||
}
|
||||
else if( token == T_STRING )
|
||||
{
|
||||
fieldValue = CurText();
|
||||
}
|
||||
}
|
||||
|
||||
if( !fieldName.IsEmpty() )
|
||||
fields[fieldName] = fieldValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
Expecting( "field" );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case T_sheetpath:
|
||||
while( ( token = NextTok() ) != T_EOF )
|
||||
{
|
||||
|
@ -445,6 +486,7 @@ void KICAD_NETLIST_PARSER::parseComponent()
|
|||
component->SetName( name );
|
||||
component->SetLibrary( library );
|
||||
component->SetProperties( properties );
|
||||
component->SetFields( fields );
|
||||
m_netlist->AddComponent( component );
|
||||
}
|
||||
|
||||
|
|
|
@ -128,6 +128,9 @@ public:
|
|||
void SetValue( const wxString& aValue ) { m_value = aValue; }
|
||||
const wxString& GetValue() const { return m_value; }
|
||||
|
||||
void SetFields( std::map<wxString, wxString>& aFields ) { m_fields = std::move( aFields ); }
|
||||
const std::map<wxString, wxString>& GetFields() const { return m_fields; }
|
||||
|
||||
void SetProperties( std::map<wxString, wxString>& aProps )
|
||||
{
|
||||
m_properties = std::move( aProps );
|
||||
|
@ -198,6 +201,9 @@ private:
|
|||
/// Component-specific properties found in the netlist.
|
||||
std::map<wxString, wxString> m_properties;
|
||||
|
||||
/// Component-specific user fields found in the netlist.
|
||||
std::map<wxString, wxString> m_fields;
|
||||
|
||||
static COMPONENT_NET m_emptyNet;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue