Don't rely on HasConversion() for Symbol Properties in Symbol Editor.

Fixes https://gitlab.com/kicad/code/kicad/issues/11200
This commit is contained in:
Jeff Young 2022-03-24 18:30:53 +00:00
parent 7659f3c81b
commit 2681ad6cfc
2 changed files with 12 additions and 5 deletions

View File

@ -88,10 +88,10 @@ bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataToWindow()
bool enblConvOptStyle = symbol && symbol->HasConversion();
// if a symbol contains no graphic items, symbol->HasConversion() returns false.
// but when creating a new symbol, with DeMorgan option set, the ApplyToAllConversions
// must be enabled even if symbol->HasConversion() returns false in order to be able
// to create graphic items shared by all body styles
// If a symbol contains no conversion-specific pins or graphic items, symbol->HasConversion()
// will return false.
// But when creating a new symbol, with DeMorgan option set, the ApplyToAllConversions
// must be enabled in order to be able to create graphic items shared by all body styles.
if( m_frame->GetShowDeMorgan() )
enblConvOptStyle = true;

View File

@ -172,7 +172,13 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow()
m_SelNumberOfUnits->SetValue( m_libEntry->GetUnitCount() );
m_OptionPartsInterchangeable->SetValue( !m_libEntry->UnitsLocked() ||
m_libEntry->GetUnitCount() == 1 );
m_AsConvertButt->SetValue( m_libEntry->HasConversion() );
// If a symbol contains no conversion-specific pins or graphic items, symbol->HasConversion()
// will return false. But when editing a symbol with DeMorgan option set, we don't want to
// keep turning it off just because there aren't any conversion-specific items yet, so we force
// it to on if the parent frame has it enabled.
m_AsConvertButt->SetValue( m_Parent->GetShowDeMorgan() );
m_OptionPower->SetValue( m_libEntry->IsPower() );
m_excludeFromBomCheckBox->SetValue( !m_libEntry->GetIncludeInBom() );
m_excludeFromBoardCheckBox->SetValue( !m_libEntry->GetIncludeOnBoard() );
@ -365,6 +371,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
m_libEntry->LockUnits( m_libEntry->GetUnitCount() > 1 &&
!m_OptionPartsInterchangeable->GetValue() );
m_libEntry->SetConversion( m_AsConvertButt->GetValue() );
m_Parent->SetShowDeMorgan( m_AsConvertButt->GetValue() );
if( m_OptionPower->GetValue() )
m_libEntry->SetPower();