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.
This commit is contained in:
John Beard 2024-05-16 20:44:18 +08:00
parent 3622a296be
commit c3e7509823
2 changed files with 8 additions and 0 deletions

View File

@ -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( "Width" ) );
propMgr.Mask( TYPE_HASH( LIB_FIELD ), TYPE_HASH( EDA_TEXT ), _HKI( "Height" ) ); propMgr.Mask( TYPE_HASH( LIB_FIELD ), TYPE_HASH( EDA_TEXT ), _HKI( "Height" ) );
propMgr.AddProperty( new PROPERTY<LIB_FIELD, int>(
_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" ) ); propMgr.Mask( TYPE_HASH( LIB_FIELD ), TYPE_HASH( EDA_TEXT ), _HKI( "Orientation" ) );
} }
} _LIB_FIELD_DESC; } _LIB_FIELD_DESC;

View File

@ -161,6 +161,9 @@ public:
wxString GetShownText( bool aAllowExtraText, int aDepth = 0 ) const override; 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; SCH_LAYER_ID GetDefaultLayer() const;
void BeginEdit( const VECTOR2I& aStartPoint ) override; void BeginEdit( const VECTOR2I& aStartPoint ) override;