From 899ed59f7bdc95c8f3bb7e8ee445b419acaedd3b Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Mon, 5 Feb 2024 19:08:56 -0500 Subject: [PATCH] Add missing pin numbers/names properties --- eeschema/sch_symbol.cpp | 18 ++++++++++++++++++ eeschema/sch_symbol.h | 19 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index b07fa7e294..0a0bd6e3ba 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -2673,6 +2673,24 @@ static struct SCH_SYMBOL_DESC propMgr.AddProperty( new PROPERTY( _HKI( "Mirror Y" ), &SCH_SYMBOL::SetMirrorY, &SCH_SYMBOL::GetMirrorY ) ); + auto hasLibPart = []( INSPECTABLE* aItem ) -> bool + { + if( SCH_SYMBOL* symbol = dynamic_cast( aItem ) ) + return symbol->GetLibSymbolRef().get() != nullptr; + + return false; + }; + + propMgr.AddProperty( new PROPERTY( _HKI( "Pin numbers" ), + &SCH_SYMBOL::SetShowPinNumbers, + &SCH_SYMBOL::GetShowPinNumbers ) ) + .SetAvailableFunc( hasLibPart ); + + propMgr.AddProperty( new PROPERTY( _HKI( "Pin names" ), + &SCH_SYMBOL::SetShowPinNames, + &SCH_SYMBOL::GetShowPinNames ) ) + .SetAvailableFunc( hasLibPart ); + auto isMultiUnitSymbol = []( INSPECTABLE* aItem ) -> bool { diff --git a/eeschema/sch_symbol.h b/eeschema/sch_symbol.h index e1d034d8b0..b15e84413a 100644 --- a/eeschema/sch_symbol.h +++ b/eeschema/sch_symbol.h @@ -863,6 +863,25 @@ public: bool GetDNP() const { return m_DNP; } void SetDNP( bool aDNP ) { m_DNP = aDNP; } + bool GetShowPinNumbers() const + { + return m_part && m_part->ShowPinNumbers(); + } + + void SetShowPinNumbers( bool aShow ) + { + if( m_part ) + m_part->SetShowPinNumbers( aShow ); + } + + bool GetShowPinNames() const { return m_part && m_part->ShowPinNames(); } + + void SetShowPinNames( bool aShow ) + { + if( m_part ) + m_part->SetShowPinNames( aShow ); + } + bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override; /**