ADDED: row height and column width property inspector properties.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21224
This commit is contained in:
Jeff Young 2025-07-01 20:33:02 -06:00
parent 423a1705af
commit 18d9e113a6
3 changed files with 54 additions and 1 deletions

View File

@ -98,6 +98,36 @@ wxString PCB_TABLECELL::GetAddr() const
}
int PCB_TABLECELL::GetColumnWidth() const
{
return static_cast<PCB_TABLE*>( GetParent() )->GetColWidth( GetColumn() );
}
void PCB_TABLECELL::SetColumnWidth( int aWidth )
{
PCB_TABLE* table = static_cast<PCB_TABLE*>( GetParent() );
table->SetColWidth( GetColumn(), aWidth );
table->Normalize();
}
int PCB_TABLECELL::GetRowHeight() const
{
return static_cast<PCB_TABLE*>( GetParent() )->GetRowHeight( GetRow() );
}
void PCB_TABLECELL::SetRowHeight( int aHeight )
{
PCB_TABLE* table = static_cast<PCB_TABLE*>( GetParent() );
table->SetRowHeight( GetRow(), aHeight );
table->Normalize();
}
void PCB_TABLECELL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{
aList.emplace_back( _( "Table Cell" ), GetAddr() );
@ -214,5 +244,17 @@ static struct PCB_TABLECELL_DESC
propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_TEXT ), _HKI( "Orientation" ) );
propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_TEXT ), _HKI( "Hyperlink" ) );
propMgr.Mask( TYPE_HASH( PCB_TABLECELL ), TYPE_HASH( EDA_TEXT ), _HKI( "Color" ) );
const wxString tableProps = _( "Table" );
propMgr.AddProperty( new PROPERTY<PCB_TABLECELL, int>( _HKI( "Column Width" ),
&PCB_TABLECELL::SetColumnWidth, &PCB_TABLECELL::GetColumnWidth,
PROPERTY_DISPLAY::PT_SIZE ),
tableProps );
propMgr.AddProperty( new PROPERTY<PCB_TABLECELL, int>( _HKI( "Row Height" ),
&PCB_TABLECELL::SetRowHeight, &PCB_TABLECELL::GetRowHeight,
PROPERTY_DISPLAY::PT_SIZE ),
tableProps );
}
} _PCB_TABLECELL_DESC;

View File

@ -71,6 +71,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 );
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;

View File

@ -233,7 +233,12 @@ void PCB_PROPERTIES_PANEL::valueChanged( wxPropertyGridEvent& aEvent )
continue;
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( edaItem );
changes.Modify( item, nullptr, RECURSE_MODE::NO_RECURSE );
if( item->Type() == PCB_TABLECELL_T )
changes.Modify( item->GetParent(), nullptr, RECURSE_MODE::NO_RECURSE );
else
changes.Modify( item, nullptr, RECURSE_MODE::NO_RECURSE );
item->Set( property, newValue );
}