From 2681ad6cfc8c80059a0dcc35f67063b77b0c53ee Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 24 Mar 2022 18:30:53 +0000 Subject: [PATCH] Don't rely on HasConversion() for Symbol Properties in Symbol Editor. Fixes https://gitlab.com/kicad/code/kicad/issues/11200 --- eeschema/dialogs/dialog_lib_shape_properties.cpp | 8 ++++---- eeschema/dialogs/dialog_lib_symbol_properties.cpp | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/eeschema/dialogs/dialog_lib_shape_properties.cpp b/eeschema/dialogs/dialog_lib_shape_properties.cpp index 8ce8ff6b36..e283f763e1 100644 --- a/eeschema/dialogs/dialog_lib_shape_properties.cpp +++ b/eeschema/dialogs/dialog_lib_shape_properties.cpp @@ -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; diff --git a/eeschema/dialogs/dialog_lib_symbol_properties.cpp b/eeschema/dialogs/dialog_lib_symbol_properties.cpp index 38d17ede6e..d55f130682 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_lib_symbol_properties.cpp @@ -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();