add support to update an already existing field
(cherry picked from commit d45911f54b
)
This commit is contained in:
parent
f1d687cfdb
commit
f7765ea5b9
|
@ -453,15 +453,32 @@ LIB_SYMBOL* SCH_IO_HTTP_LIB::loadSymbolFromPart( const wxString& aSymbo
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Generic fields
|
// Check if field exists, if so replace Text and adjust visiblity.
|
||||||
field = new LIB_FIELD( symbol->GetNextAvailableFieldId() );
|
//
|
||||||
field->SetName( fieldName );
|
// This proves useful in situations where, for instance, an individual requires a particular value, such as
|
||||||
|
// the material type showcased at a specific position for a capacitor. Subsequently, this value could be defined
|
||||||
|
// in the symbol itself and then, potentially, be modified by the HTTP library as necessary.
|
||||||
|
field = symbol->FindField( fieldName );
|
||||||
|
|
||||||
field->SetText( std::get<0>( fieldProperties ) );
|
if( field != nullptr )
|
||||||
field->SetVisible( std::get<1>( fieldProperties ) );
|
{
|
||||||
symbol->AddField( field );
|
// adjust values accordingly
|
||||||
|
field->SetText( std::get<0>( fieldProperties ) );
|
||||||
|
field->SetVisible( std::get<1>( fieldProperties ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Generic fields
|
||||||
|
field = new LIB_FIELD( symbol->GetNextAvailableFieldId() );
|
||||||
|
field->SetName( fieldName );
|
||||||
|
|
||||||
|
field->SetText( std::get<0>( fieldProperties ) );
|
||||||
|
field->SetVisible( std::get<1>( fieldProperties ) );
|
||||||
|
symbol->AddField( field );
|
||||||
|
|
||||||
|
m_customFields.insert( fieldName );
|
||||||
|
}
|
||||||
|
|
||||||
m_customFields.insert( fieldName );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue