PANEL_SETUP_TRACKS_AND_VIAS: fix UI issues.

Fixes #8264
https://gitlab.com/kicad/code/kicad/issues/8264
This commit is contained in:
jean-pierre charras 2021-04-23 10:58:59 +02:00
parent 7569fc8aad
commit 3be17ceb50
4 changed files with 39 additions and 29 deletions

View File

@ -82,6 +82,23 @@ PANEL_SETUP_TRACKS_AND_VIAS::PANEL_SETUP_TRACKS_AND_VIAS( PAGED_DIALOG* aParent,
m_trackWidthsGrid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows ); m_trackWidthsGrid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
m_viaSizesGrid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows ); m_viaSizesGrid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
m_diffPairsGrid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows ); m_diffPairsGrid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
// Ensure width of columns is enough to enter any reasonable value
WX_GRID* grid_list[] = { m_trackWidthsGrid, m_viaSizesGrid, m_diffPairsGrid, nullptr };
int min_linesize = m_trackWidthsGrid->GetTextExtent( "000.000000 mm " ).x;
for( int ii = 0; grid_list[ii]; ii++ )
{
WX_GRID* curr_grid = grid_list[ii];
for( int col = 0; col < curr_grid->GetNumberCols(); col++ )
{
int min_w = curr_grid->GetVisibleWidth( col, true, true, true );
int best_w = std::max( min_linesize, min_w );
curr_grid->SetColMinimalWidth( col, best_w );
curr_grid->SetColSize( col,best_w );
}
}
} }
PANEL_SETUP_TRACKS_AND_VIAS::~PANEL_SETUP_TRACKS_AND_VIAS() PANEL_SETUP_TRACKS_AND_VIAS::~PANEL_SETUP_TRACKS_AND_VIAS()

View File

@ -33,10 +33,9 @@ PANEL_SETUP_TRACKS_AND_VIAS_BASE::PANEL_SETUP_TRACKS_AND_VIAS_BASE( wxWindow* pa
m_trackWidthsGrid->EnableEditing( true ); m_trackWidthsGrid->EnableEditing( true );
m_trackWidthsGrid->EnableGridLines( true ); m_trackWidthsGrid->EnableGridLines( true );
m_trackWidthsGrid->EnableDragGridSize( false ); m_trackWidthsGrid->EnableDragGridSize( false );
m_trackWidthsGrid->SetMargins( 0, 0 ); m_trackWidthsGrid->SetMargins( 40, 0 );
// Columns // Columns
m_trackWidthsGrid->SetColSize( 0, 125 );
m_trackWidthsGrid->EnableDragColMove( false ); m_trackWidthsGrid->EnableDragColMove( false );
m_trackWidthsGrid->EnableDragColSize( false ); m_trackWidthsGrid->EnableDragColSize( false );
m_trackWidthsGrid->SetColLabelSize( 24 ); m_trackWidthsGrid->SetColLabelSize( 24 );
@ -78,7 +77,7 @@ PANEL_SETUP_TRACKS_AND_VIAS_BASE::PANEL_SETUP_TRACKS_AND_VIAS_BASE( wxWindow* pa
sbSizer4->Add( bSizer3, 0, wxEXPAND|wxTOP, 2 ); sbSizer4->Add( bSizer3, 0, wxEXPAND|wxTOP, 2 );
bSizerLower->Add( sbSizer4, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 ); bSizerLower->Add( sbSizer4, 0, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer5; wxStaticBoxSizer* sbSizer5;
sbSizer5 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Vias") ), wxVERTICAL ); sbSizer5 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Vias") ), wxVERTICAL );
@ -90,11 +89,9 @@ PANEL_SETUP_TRACKS_AND_VIAS_BASE::PANEL_SETUP_TRACKS_AND_VIAS_BASE( wxWindow* pa
m_viaSizesGrid->EnableEditing( true ); m_viaSizesGrid->EnableEditing( true );
m_viaSizesGrid->EnableGridLines( true ); m_viaSizesGrid->EnableGridLines( true );
m_viaSizesGrid->EnableDragGridSize( false ); m_viaSizesGrid->EnableDragGridSize( false );
m_viaSizesGrid->SetMargins( 0, 0 ); m_viaSizesGrid->SetMargins( 40, 0 );
// Columns // Columns
m_viaSizesGrid->SetColSize( 0, 125 );
m_viaSizesGrid->SetColSize( 1, 125 );
m_viaSizesGrid->EnableDragColMove( false ); m_viaSizesGrid->EnableDragColMove( false );
m_viaSizesGrid->EnableDragColSize( false ); m_viaSizesGrid->EnableDragColSize( false );
m_viaSizesGrid->SetColLabelSize( 24 ); m_viaSizesGrid->SetColLabelSize( 24 );
@ -137,7 +134,7 @@ PANEL_SETUP_TRACKS_AND_VIAS_BASE::PANEL_SETUP_TRACKS_AND_VIAS_BASE( wxWindow* pa
sbSizer5->Add( bSizer4, 0, wxEXPAND|wxTOP, 2 ); sbSizer5->Add( bSizer4, 0, wxEXPAND|wxTOP, 2 );
bSizerLower->Add( sbSizer5, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 ); bSizerLower->Add( sbSizer5, 0, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer6; wxStaticBoxSizer* sbSizer6;
sbSizer6 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Differential Pairs") ), wxVERTICAL ); sbSizer6 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Differential Pairs") ), wxVERTICAL );
@ -149,14 +146,11 @@ PANEL_SETUP_TRACKS_AND_VIAS_BASE::PANEL_SETUP_TRACKS_AND_VIAS_BASE( wxWindow* pa
m_diffPairsGrid->EnableEditing( true ); m_diffPairsGrid->EnableEditing( true );
m_diffPairsGrid->EnableGridLines( true ); m_diffPairsGrid->EnableGridLines( true );
m_diffPairsGrid->EnableDragGridSize( false ); m_diffPairsGrid->EnableDragGridSize( false );
m_diffPairsGrid->SetMargins( 0, 0 ); m_diffPairsGrid->SetMargins( 40, 0 );
// Columns // Columns
m_diffPairsGrid->SetColSize( 0, 125 );
m_diffPairsGrid->SetColSize( 1, 125 );
m_diffPairsGrid->SetColSize( 2, 125 );
m_diffPairsGrid->EnableDragColMove( false ); m_diffPairsGrid->EnableDragColMove( false );
m_diffPairsGrid->EnableDragColSize( true ); m_diffPairsGrid->EnableDragColSize( false );
m_diffPairsGrid->SetColLabelSize( 24 ); m_diffPairsGrid->SetColLabelSize( 24 );
m_diffPairsGrid->SetColLabelValue( 0, _("Width") ); m_diffPairsGrid->SetColLabelValue( 0, _("Width") );
m_diffPairsGrid->SetColLabelValue( 1, _("Gap") ); m_diffPairsGrid->SetColLabelValue( 1, _("Gap") );
@ -164,7 +158,7 @@ PANEL_SETUP_TRACKS_AND_VIAS_BASE::PANEL_SETUP_TRACKS_AND_VIAS_BASE( wxWindow* pa
m_diffPairsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); m_diffPairsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows // Rows
m_diffPairsGrid->EnableDragRowSize( true ); m_diffPairsGrid->EnableDragRowSize( false );
m_diffPairsGrid->SetRowLabelSize( 0 ); m_diffPairsGrid->SetRowLabelSize( 0 );
m_diffPairsGrid->SetRowLabelValue( 0, _("1") ); m_diffPairsGrid->SetRowLabelValue( 0, _("1") );
m_diffPairsGrid->SetRowLabelValue( 1, _("2") ); m_diffPairsGrid->SetRowLabelValue( 1, _("2") );
@ -199,7 +193,7 @@ PANEL_SETUP_TRACKS_AND_VIAS_BASE::PANEL_SETUP_TRACKS_AND_VIAS_BASE( wxWindow* pa
sbSizer6->Add( bSizer5, 0, wxEXPAND|wxTOP, 2 ); sbSizer6->Add( bSizer5, 0, wxEXPAND|wxTOP, 2 );
bSizerLower->Add( sbSizer6, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 ); bSizerLower->Add( sbSizer6, 0, wxEXPAND, 5 );
bMainSizer->Add( bSizerLower, 5, wxEXPAND|wxLEFT, 20 ); bMainSizer->Add( bSizerLower, 5, wxEXPAND|wxLEFT, 20 );
@ -207,7 +201,6 @@ PANEL_SETUP_TRACKS_AND_VIAS_BASE::PANEL_SETUP_TRACKS_AND_VIAS_BASE( wxWindow* pa
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
bMainSizer->Fit( this );
// Connect Events // Connect Events
m_trackWidthsAddButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_TRACKS_AND_VIAS_BASE::OnAddTrackWidthsClick ), NULL, this ); m_trackWidthsAddButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_TRACKS_AND_VIAS_BASE::OnAddTrackWidthsClick ), NULL, this );

View File

@ -43,7 +43,7 @@
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">PANEL_SETUP_TRACKS_AND_VIAS_BASE</property> <property name="name">PANEL_SETUP_TRACKS_AND_VIAS_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">-1,-1</property> <property name="size">674,343</property>
<property name="subclass">; forward_declare</property> <property name="subclass">; forward_declare</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
@ -126,7 +126,7 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT|wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
@ -167,7 +167,7 @@
<property name="col_label_values">&quot;Width&quot;</property> <property name="col_label_values">&quot;Width&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property> <property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">1</property> <property name="cols">1</property>
<property name="column_sizes">125</property> <property name="column_sizes"></property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
<property name="default_pane">0</property> <property name="default_pane">0</property>
@ -192,7 +192,7 @@
<property name="label_font"></property> <property name="label_font"></property>
<property name="label_text"></property> <property name="label_text"></property>
<property name="margin_height">0</property> <property name="margin_height">0</property>
<property name="margin_width">0</property> <property name="margin_width">40</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
@ -394,8 +394,8 @@
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">10</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
@ -436,7 +436,7 @@
<property name="col_label_values">&quot;Size&quot; &quot;Hole&quot;</property> <property name="col_label_values">&quot;Size&quot; &quot;Hole&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property> <property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">2</property> <property name="cols">2</property>
<property name="column_sizes">125,125</property> <property name="column_sizes"></property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
<property name="default_pane">0</property> <property name="default_pane">0</property>
@ -461,7 +461,7 @@
<property name="label_font"></property> <property name="label_font"></property>
<property name="label_text"></property> <property name="label_text"></property>
<property name="margin_height">0</property> <property name="margin_height">0</property>
<property name="margin_width">0</property> <property name="margin_width">40</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
@ -664,7 +664,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT|wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
@ -705,7 +705,7 @@
<property name="col_label_values">&quot;Width&quot; &quot;Gap&quot; &quot;Via Gap&quot;</property> <property name="col_label_values">&quot;Width&quot; &quot;Gap&quot; &quot;Via Gap&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property> <property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">3</property> <property name="cols">3</property>
<property name="column_sizes">125,125,125</property> <property name="column_sizes"></property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
<property name="default_pane">0</property> <property name="default_pane">0</property>
@ -713,9 +713,9 @@
<property name="dock_fixed">0</property> <property name="dock_fixed">0</property>
<property name="docking">Left</property> <property name="docking">Left</property>
<property name="drag_col_move">0</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_grid_size">0</property>
<property name="drag_row_size">1</property> <property name="drag_row_size">0</property>
<property name="editing">1</property> <property name="editing">1</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
@ -730,7 +730,7 @@
<property name="label_font"></property> <property name="label_font"></property>
<property name="label_text"></property> <property name="label_text"></property>
<property name="margin_height">0</property> <property name="margin_height">0</property>
<property name="margin_width">0</property> <property name="margin_width">40</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>

View File

@ -60,7 +60,7 @@ class PANEL_SETUP_TRACKS_AND_VIAS_BASE : public wxPanel
public: public:
PANEL_SETUP_TRACKS_AND_VIAS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); PANEL_SETUP_TRACKS_AND_VIAS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 674,343 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_SETUP_TRACKS_AND_VIAS_BASE(); ~PANEL_SETUP_TRACKS_AND_VIAS_BASE();
}; };