Handle new fields in global field editor.

Fixes: lp:1765443
* https://bugs.launchpad.net/kicad/+bug/1765443
This commit is contained in:
Jeff Young 2018-04-19 18:55:16 +01:00
parent f81c77cd4e
commit 9201417c06
1 changed files with 8 additions and 5 deletions

View File

@ -353,12 +353,15 @@ public:
std::map<wxString, wxString>& fieldStore = m_dataStore[ comp->GetTimeStamp() ];
for( int j = 0; j < comp->GetFieldCount(); ++j )
for( std::pair<wxString, wxString> fieldData : fieldStore )
{
SCH_FIELD* field = comp->GetField( j );
auto fieldStoreData = fieldStore.find( field->GetName() );
if( fieldStoreData != fieldStore.end() )
field->SetText( fieldStoreData->second );
wxString fieldName = fieldData.first;
SCH_FIELD* field = comp->FindField( fieldName );
if( !field )
field = comp->AddField( SCH_FIELD( wxPoint( 0, 0 ), -1, comp, fieldName ) );
field->SetText( fieldData.second );
}
}
}