modedit: Fix footprint properties dialog
Checks for text in the dialog before setting width. Also prevents resizing beyond the width of the window (in the case of large fonts)
This commit is contained in:
parent
2948f8a6bc
commit
8b46c99c60
|
@ -237,7 +237,13 @@ int WX_GRID::GetVisibleWidth( int aCol, bool aHeader, bool aContents, bool aKeep
|
|||
}
|
||||
|
||||
for( int row = 0; aContents && row < GetNumberRows(); row++ )
|
||||
size = std::max( size, GetTextExtent( GetCellValue( row, aCol ) + "M" ).x );
|
||||
{
|
||||
// If we have text, get the size. Otherwise, use a placeholder for the checkbox
|
||||
if( GetTable()->CanGetValueAs( row, aCol, wxGRID_VALUE_STRING ) )
|
||||
size = std::max( size, GetTextExtent( GetCellValue( row, aCol ) + "M" ).x );
|
||||
else
|
||||
size = std::max( size, GetTextExtent( "MM" ).x );
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
|
|
|
@ -307,6 +307,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow()
|
|||
}
|
||||
|
||||
m_itemsGrid->SetRowLabelSize( m_itemsGrid->GetVisibleWidth( -1, true, true, true ) );
|
||||
m_modelsGrid->SetColSize( 1, m_modelsGrid->GetVisibleWidth( 1, true, false, false ) );
|
||||
|
||||
Layout();
|
||||
adjustGridColumns( m_itemsGrid->GetRect().GetWidth());
|
||||
|
@ -779,7 +780,9 @@ void DIALOG_FOOTPRINT_FP_EDITOR::adjustGridColumns( int aWidth )
|
|||
for( int i = 1; i < m_itemsGrid->GetNumberCols(); i++ )
|
||||
itemsWidth -= m_itemsGrid->GetColSize( i );
|
||||
|
||||
m_itemsGrid->SetColSize( 0, std::max( itemsWidth, 120 ) );
|
||||
if( itemsWidth > 0 )
|
||||
m_itemsGrid->SetColSize( 0, std::max( itemsWidth,
|
||||
m_itemsGrid->GetVisibleWidth( 0, true, false, false ) ) );
|
||||
|
||||
m_modelsGrid->SetColSize( 0, modelsWidth - m_modelsGrid->GetColSize( 1 ) - 5 );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue