From c3e7509823d1a3728a03857ba6f4b082b53272b9 Mon Sep 17 00:00:00 2001 From: John Beard Date: Thu, 16 May 2024 20:44:18 +0800 Subject: [PATCH] Allow to set LIB_FIELD size through property manager This can be useful when managing auxiliary fields. This is only for the 8.0 branch, as LIB_FIELD is merged with SCH_FIELD in 8.99, so this is already handled. --- eeschema/lib_field.cpp | 5 +++++ eeschema/lib_field.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index 4452d804ff..14095030ff 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -664,6 +664,11 @@ static struct LIB_FIELD_DESC propMgr.Mask( TYPE_HASH( LIB_FIELD ), TYPE_HASH( EDA_TEXT ), _HKI( "Width" ) ); propMgr.Mask( TYPE_HASH( LIB_FIELD ), TYPE_HASH( EDA_TEXT ), _HKI( "Height" ) ); + propMgr.AddProperty( new PROPERTY( + _HKI( "Text Size" ), &LIB_FIELD::SetLibTextSize, + &LIB_FIELD::GetLibTextSize, PROPERTY_DISPLAY::PT_SIZE ), + _HKI( "Text Properties" ) ); + propMgr.Mask( TYPE_HASH( LIB_FIELD ), TYPE_HASH( EDA_TEXT ), _HKI( "Orientation" ) ); } } _LIB_FIELD_DESC; diff --git a/eeschema/lib_field.h b/eeschema/lib_field.h index d07343af2d..01beb5d1aa 100644 --- a/eeschema/lib_field.h +++ b/eeschema/lib_field.h @@ -161,6 +161,9 @@ public: wxString GetShownText( bool aAllowExtraText, int aDepth = 0 ) const override; + int GetLibTextSize() const { return GetTextWidth(); } + void SetLibTextSize( int aSize ) { SetTextSize( VECTOR2I( aSize, aSize ) ); } + SCH_LAYER_ID GetDefaultLayer() const; void BeginEdit( const VECTOR2I& aStartPoint ) override;