Explicitly give unit values

Removes the ability to hide symbol units in file formats.  This was
mostly the case for a while but there remained corner cases where we
left a default/hidden option

Fixes https://gitlab.com/kicad/code/kicad/issues/10888

(cherry picked from commit 8c36ba3653)
This commit is contained in:
Seth Hillbrand 2022-03-02 15:55:50 -08:00
parent 23479821e3
commit 17dc324e85
3 changed files with 6 additions and 8 deletions

View File

@ -593,7 +593,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnEditSpiceModel( wxCommandEvent& event )
{
#ifdef KICAD_SPICE
int diff = m_fields->size();
auto symbol = SCH_SYMBOL( *m_libEntry, m_libEntry->GetLibId(), nullptr );
auto symbol = SCH_SYMBOL( *m_libEntry, m_libEntry->GetLibId(), nullptr, 0 );
DIALOG_SPICE_MODEL dialog( this, symbol, m_fields );

View File

@ -1090,14 +1090,12 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aSheetPa
m_out->Print( 0, ")" );
}
int unit = -1;
int unit = aSymbol->GetUnit();
if( !( aSymbol->GetInstanceReferences().size() > 1 ) )
unit = aSymbol->GetUnit();
else if( aSheetPath != nullptr )
if( ( aSymbol->GetInstanceReferences().size() > 1 ) && aSheetPath )
unit = aSymbol->GetUnitSelection( aSheetPath );
if ( unit >= 0 )
m_out->Print( 0, " (unit %d)", unit );
m_out->Print( 0, " (unit %d)", unit );
if( aSymbol->GetConvert() == LIB_ITEM::LIB_CONVERT::DEMORGAN )
m_out->Print( 0, " (convert %d)", aSymbol->GetConvert() );

View File

@ -92,7 +92,7 @@ public:
* @param setNewItemFlag is used to set the symbol #IS_NEW and #IS_MOVING flags.
*/
SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
int unit = 0, int convert = 0, const wxPoint& pos = wxPoint( 0, 0 ) );
int unit, int convert = 0, const wxPoint& pos = wxPoint( 0, 0 ) );
SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
const wxPoint& pos = wxPoint( 0, 0 ) );