Eeschema: fix symbol properties dialog bug.
Derived symbols were causing the symbol properties grid to assume that the reference could not be edited because derived symbols inherit the reference from the parent symbol. The flattened symbols in the schematic still have the parent set which cause the issue. Clearing the parent of the flattened symbol resolves the issue. Fix a minor bug in the symbol information of derived symbols show in the symbol chooser dialog. Fixes #3723 https://gitlab.com/kicad/code/kicad/issues/3723
This commit is contained in:
parent
3543de039b
commit
371c5a9259
|
@ -58,7 +58,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( SCH_EDIT
|
|||
m_config = Kiface().KifaceSettings();
|
||||
|
||||
m_cmp = aComponent;
|
||||
m_part = GetParent()->GetLibPart( m_cmp->GetLibId(), true );
|
||||
m_part = m_cmp->GetPartRef().get();
|
||||
m_fields = new FIELDS_GRID_TABLE<SCH_FIELD>( this, aParent, m_part );
|
||||
|
||||
m_width = 0;
|
||||
|
|
|
@ -122,8 +122,13 @@ protected:
|
|||
wxString root_name = _( "Unknown" );
|
||||
wxString root_desc = "";
|
||||
|
||||
root_name = m_symbol->SharedPtr()->GetName();
|
||||
root_desc = m_symbol->SharedPtr()->GetDescription();
|
||||
std::shared_ptr< LIB_PART > parent = m_symbol->GetParent().lock();
|
||||
|
||||
if( parent )
|
||||
{
|
||||
root_name = parent->GetName();
|
||||
root_desc = parent->GetDescription();
|
||||
}
|
||||
|
||||
m_html.Replace(
|
||||
"__ALIASOF__", wxString::Format(
|
||||
|
|
|
@ -130,7 +130,12 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, LIB_ID aLibId, SCH_SHEET_PATH* sh
|
|||
m_unit = unit;
|
||||
m_convert = convert;
|
||||
m_lib_id = aLibId;
|
||||
m_part.reset( new LIB_PART( aPart ) );
|
||||
|
||||
std::unique_ptr< LIB_PART > part;
|
||||
|
||||
part = aPart.Flatten();
|
||||
part->SetParent();
|
||||
m_part.reset( part.release() );
|
||||
m_fieldsAutoplaced = AUTOPLACED_NO;
|
||||
|
||||
SetTimeStamp( GetNewTimeStamp() );
|
||||
|
@ -274,7 +279,10 @@ void SCH_COMPONENT::SetLibId( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aSymLibTab
|
|||
LIB_PART* tmp = aSymLibTable->LoadSymbol( m_lib_id );
|
||||
|
||||
if( tmp )
|
||||
{
|
||||
symbol = tmp->Flatten();
|
||||
symbol->SetParent();
|
||||
}
|
||||
}
|
||||
|
||||
if( !symbol && aCacheLib )
|
||||
|
@ -282,7 +290,10 @@ void SCH_COMPONENT::SetLibId( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aSymLibTab
|
|||
LIB_PART* tmp = aCacheLib->FindPart( m_lib_id.Format().wx_str() );
|
||||
|
||||
if( tmp )
|
||||
symbol.reset( new LIB_PART( *tmp ) );
|
||||
{
|
||||
symbol = tmp->Flatten();
|
||||
symbol->SetParent();
|
||||
}
|
||||
}
|
||||
|
||||
m_part.reset( symbol.release() );
|
||||
|
@ -318,7 +329,9 @@ bool SCH_COMPONENT::Resolve( PART_LIBS* aLibs )
|
|||
// flimsy search path ordering. None-the-less find a part based on that design:
|
||||
if( LIB_PART* part = aLibs->FindLibPart( m_lib_id ) )
|
||||
{
|
||||
m_part.reset( new LIB_PART( *part ) );
|
||||
std::unique_ptr< LIB_PART > flattenedPart = part->Flatten();
|
||||
flattenedPart->SetParent();
|
||||
m_part.reset( flattenedPart.release() );
|
||||
UpdatePins();
|
||||
return true;
|
||||
}
|
||||
|
@ -346,7 +359,10 @@ bool SCH_COMPONENT::Resolve( SYMBOL_LIB_TABLE& aLibTable, PART_LIB* aCacheLib )
|
|||
LIB_PART* tmp = aLibTable.LoadSymbol( m_lib_id );
|
||||
|
||||
if( tmp )
|
||||
{
|
||||
part = tmp->Flatten();
|
||||
part->SetParent();
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to cache library. This is temporary until the new schematic file
|
||||
|
@ -361,7 +377,10 @@ bool SCH_COMPONENT::Resolve( SYMBOL_LIB_TABLE& aLibTable, PART_LIB* aCacheLib )
|
|||
LIB_PART* tmp = aCacheLib->FindPart( libId );
|
||||
|
||||
if( tmp )
|
||||
part.reset( new LIB_PART( *tmp ) );
|
||||
{
|
||||
part = tmp->Flatten();
|
||||
part->SetParent();
|
||||
}
|
||||
}
|
||||
|
||||
if( part )
|
||||
|
|
Loading…
Reference in New Issue