Don't allow footprint text item columns to be resized.

We auto-size them in the code and doing both produces nothing but a
mess.

Also improves the auto-sizing for the layers drop-down (particularly
needed for the new, somewhat longer, layer names.

Fixes https://gitlab.com/kicad/code/kicad/issues/7671
This commit is contained in:
Jeff Young 2021-02-23 17:24:26 +00:00
parent b48071015b
commit f30eab422e
5 changed files with 27 additions and 11 deletions

View File

@ -319,12 +319,21 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow()
for( int col = 0; col < m_itemsGrid->GetNumberCols(); col++ )
{
// Adjust min size to the column label size
m_itemsGrid->SetColMinimalWidth( col, m_itemsGrid->GetVisibleWidth( col, true, false, false ) );
// Adjust the column size. The column 6 has a small bitmap, so its width must be taken in account
m_itemsGrid->SetColMinimalWidth( col, m_itemsGrid->GetVisibleWidth( col, true, false,
false ) );
// Adjust the column size.
int col_size = m_itemsGrid->GetVisibleWidth( col, true, true, false );
if( col == 6 )
if( col == FPT_LAYER ) // This one's a drop-down. Check all possible values.
{
BOARD* board = m_footprint->GetBoard();
for( PCB_LAYER_ID layer : board->GetEnabledLayers().Seq() )
col_size = std::max( col_size, GetTextExtent( board->GetLayerName( layer ) ).x );
// And the swatch:
col_size += 20;
}
if( m_itemsGrid->IsColShown( col ) )
m_itemsGrid->SetColSize( col, col_size );

View File

@ -408,12 +408,19 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow()
{
m_itemsGrid->SetColMinimalWidth( col, m_itemsGrid->GetVisibleWidth( col, true, false,
false ) );
// Adjust the column size. The column 6 has a small bitmap, so its width must be
// taken in account
// Adjust the column size.
int col_size = m_itemsGrid->GetVisibleWidth( col, true, true, false );
if( col == 6 )
if( col == FPT_LAYER ) // This one's a drop-down. Check all possible values.
{
BOARD* board = m_footprint->GetBoard();
for( PCB_LAYER_ID layer : board->GetEnabledLayers().Seq() )
col_size = std::max( col_size, GetTextExtent( board->GetLayerName( layer ) ).x );
// And the swatch:
col_size += 20;
}
if( m_itemsGrid->IsColShown( col ) )
m_itemsGrid->SetColSize( col, col_size );

View File

@ -58,7 +58,7 @@ private:
static int m_page; // remember the last open page during session
FP_TEXT_GRID_TABLE* m_texts;
FP_TEXT_GRID_TABLE* m_texts;
UNIT_BINDER m_posX;
UNIT_BINDER m_posY;
wxFloatingPointValidator<double> m_OrientValidator;

View File

@ -42,13 +42,13 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_BASE( wxWindow* pa
m_itemsGrid->SetColSize( 3, 110 );
m_itemsGrid->SetColSize( 4, 110 );
m_itemsGrid->SetColSize( 5, 60 );
m_itemsGrid->SetColSize( 6, 110 );
m_itemsGrid->SetColSize( 6, 140 );
m_itemsGrid->SetColSize( 7, 110 );
m_itemsGrid->SetColSize( 8, 110 );
m_itemsGrid->SetColSize( 9, 110 );
m_itemsGrid->SetColSize( 10, 110 );
m_itemsGrid->EnableDragColMove( false );
m_itemsGrid->EnableDragColSize( true );
m_itemsGrid->EnableDragColSize( false );
m_itemsGrid->SetColLabelSize( 24 );
m_itemsGrid->SetColLabelValue( 0, _("Text Items") );
m_itemsGrid->SetColLabelValue( 1, _("Show") );

View File

@ -221,7 +221,7 @@
<property name="col_label_values">&quot;Text Items&quot; &quot;Show&quot; &quot;Width&quot; &quot;Height&quot; &quot;Thickness&quot; &quot;Italic&quot; &quot;Layer&quot; &quot;Orientation&quot; &quot;Keep Upright&quot; &quot;X Offset&quot; &quot;Y Offset&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">11</property>
<property name="column_sizes">124,60,110,110,110,60,110,110,110,110,110</property>
<property name="column_sizes">124,60,110,110,110,60,140,110,110,110,110</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
@ -229,7 +229,7 @@
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">1</property>
<property name="drag_col_size">0</property>
<property name="drag_grid_size">0</property>
<property name="drag_row_size">0</property>
<property name="editing">1</property>