ADDED: row height and column width property inspector properties.

(This time for SCH tables.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21224

(cherry picked from commit ee097a7073f8c8927acb0a45b947d700decffa20)
This commit is contained in:
Jeff Young 2025-07-04 03:53:12 -06:00
parent 86c475ced9
commit b6dd1d2a46
3 changed files with 57 additions and 1 deletions

View File

@ -95,6 +95,36 @@ wxString SCH_TABLECELL::GetAddr() const
}
int SCH_TABLECELL::GetColumnWidth() const
{
return static_cast<SCH_TABLE*>( GetParent() )->GetColWidth( GetColumn() );
}
void SCH_TABLECELL::SetColumnWidth( int aWidth )
{
SCH_TABLE* table = static_cast<SCH_TABLE*>( GetParent() );
table->SetColWidth( GetColumn(), aWidth );
table->Normalize();
}
int SCH_TABLECELL::GetRowHeight() const
{
return static_cast<SCH_TABLE*>( GetParent() )->GetRowHeight( GetRow() );
}
void SCH_TABLECELL::SetRowHeight( int aHeight )
{
SCH_TABLE* table = static_cast<SCH_TABLE*>( GetParent() );
table->SetRowHeight( GetRow(), aHeight );
table->Normalize();
}
void SCH_TABLECELL::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
{
@ -206,5 +236,17 @@ static struct SCH_TABLECELL_DESC
propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_TEXT ), _HKI( "Mirrored" ) );
propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_TEXT ), _HKI( "Visible" ) );
propMgr.Mask( TYPE_HASH( SCH_TABLECELL ), TYPE_HASH( EDA_TEXT ), _HKI( "Hyperlink" ) );
const wxString tableProps = _( "Table" );
propMgr.AddProperty( new PROPERTY<SCH_TABLECELL, int>( _HKI( "Column Width" ),
&SCH_TABLECELL::SetColumnWidth, &SCH_TABLECELL::GetColumnWidth,
PROPERTY_DISPLAY::PT_SIZE ),
tableProps );
propMgr.AddProperty( new PROPERTY<SCH_TABLECELL, int>( _HKI( "Row Height" ),
&SCH_TABLECELL::SetRowHeight, &SCH_TABLECELL::GetRowHeight,
PROPERTY_DISPLAY::PT_SIZE ),
tableProps );
}
} _SCH_TABLECELL_DESC;

View File

@ -64,6 +64,12 @@ public:
int GetRowSpan() const { return m_rowSpan; }
void SetRowSpan( int aSpan ) { m_rowSpan = aSpan; }
int GetRowHeight() const;
void SetRowHeight( int aHeight );
int GetColumnWidth() const;
void SetColumnWidth( int aWidth );
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
const VECTOR2I& offset, bool aForceNoFill, bool aDimmed ) override;

View File

@ -198,8 +198,16 @@ void SCH_PROPERTIES_PANEL::valueChanged( wxPropertyGridEvent& aEvent )
for( EDA_ITEM* edaItem : selection )
{
if( !edaItem->IsSCH_ITEM() )
continue;
SCH_ITEM* item = static_cast<SCH_ITEM*>( edaItem );
changes.Modify( item, screen );
if( item->Type() == SCH_TABLECELL_T )
changes.Modify( item->GetParent(), screen );
else
changes.Modify( item, screen );
item->Set( property, newValue );
if( SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item ) )