ADDED: row height and column width property inspector properties.

(This time for SCH tables.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21224
This commit is contained in:
Jeff Young 2025-07-03 20:53:12 -06:00
parent 0375985d58
commit ee097a7073
3 changed files with 54 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::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
{
@ -198,5 +228,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

@ -67,6 +67,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 Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;

View File

@ -202,7 +202,12 @@ void SCH_PROPERTIES_PANEL::valueChanged( wxPropertyGridEvent& aEvent )
continue;
SCH_ITEM* item = static_cast<SCH_ITEM*>( edaItem );
changes.Modify( item, screen, RECURSE_MODE::NO_RECURSE );
if( item->Type() == SCH_TABLECELL_T )
changes.Modify( item->GetParent(), screen, RECURSE_MODE::NO_RECURSE );
else
changes.Modify( item, screen, RECURSE_MODE::NO_RECURSE );
item->Set( property, newValue );
if( SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item ) )