Eeschema, Add new symbol to schematics: update Value and Footprint texts

to be currently displayed.
Fixes #9025
https://gitlab.com/kicad/code/kicad/issues/9025
This commit is contained in:
jean-pierre charras 2021-08-25 15:13:40 +02:00
parent 5f2d238c93
commit a5560bb5f9
1 changed files with 9 additions and 0 deletions

View File

@ -38,6 +38,7 @@
#include <wx/log.h>
#include <string_utils.h>
/**
* Convert a wxString to UTF8 and replace any control characters with a ~,
* where a control character is one of the first ASCII values up to ' ' 32d.
@ -128,8 +129,16 @@ SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId,
m_prefix = UTIL::GetRefDesPrefix( m_part->GetReferenceField().GetText() );
if( aSheet )
{
SetRef( aSheet, UTIL::GetRefDesUnannotated( m_prefix ) );
// Value and footprint name are stored in the SCH_SHEET_PATH path manager,
// if aSheet != nullptr, not in the symbol itself.
// Copy them to the currently displayed field texts
SetValue( GetValue( aSheet, false ) );
SetFootprint( GetFootprint( aSheet, false ) );
}
// Inherit the include in bill of materials and board netlist settings from library symbol.
m_inBom = aSymbol.GetIncludeInBom();
m_onBoard = aSymbol.GetIncludeOnBoard();