Fix hole table grow issue.

Fixes https://gitlab.com/kicad/code/kicad/issues/9666
This commit is contained in:
Jeff Young 2021-11-17 12:49:21 +00:00
parent 1bb750814d
commit ffae6c8f56
4 changed files with 56 additions and 53 deletions

View File

@ -29,6 +29,7 @@
#include <pad.h>
#include <macros.h>
#include <wildcards_and_files_ext.h>
#include <widgets/wx_grid.h>
#include <wx/filedlg.h>
#define COL_LABEL 0
@ -82,7 +83,6 @@ DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS( PCB_EDIT_FRAME* aParentFrame )
{
m_parentFrame = aParentFrame;
m_gridDrills->UseNativeColHeader();
m_gridDrills->Connect( wxEVT_GRID_COL_SORT,
wxGridEventHandler( DIALOG_BOARD_STATISTICS::drillGridSort ),
nullptr, this );
@ -180,7 +180,7 @@ bool DIALOG_BOARD_STATISTICS::TransferDataToWindow()
getDataFromPCB();
updateWidets();
Layout();
drillsPanel->Layout();
m_drillsPanel->Layout();
finishDialogSettings();
return true;
}
@ -441,6 +441,7 @@ void DIALOG_BOARD_STATISTICS::updateWidets()
m_gridBoard->AutoSize();
m_gridVias->AutoSize();
m_gridDrills->AutoSize();
m_gridDrills->EnsureColLabelsVisible();
adjustDrillGridColumns();
}
@ -630,7 +631,7 @@ void DIALOG_BOARD_STATISTICS::checkboxClicked( wxCommandEvent& aEvent )
getDataFromPCB();
updateWidets();
Layout();
drillsPanel->Layout();
m_drillsPanel->Layout();
}

View File

@ -5,6 +5,8 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/wx_grid.h"
#include "dialog_board_statistics_base.h"
///////////////////////////////////////////////////////////////////////////
@ -17,7 +19,7 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx
bMainBoxSizer = new wxBoxSizer( wxVERTICAL );
topNotebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
generalPanel = new wxPanel( topNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_generalPanel = new wxPanel( topNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bGeneralPanelSizer;
bGeneralPanelSizer = new wxBoxSizer( wxVERTICAL );
@ -34,11 +36,11 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx
bSizerComponents = new wxBoxSizer( wxVERTICAL );
wxStaticText* componentsLabel;
componentsLabel = new wxStaticText( generalPanel, wxID_ANY, _("Components"), wxDefaultPosition, wxDefaultSize, 0 );
componentsLabel = new wxStaticText( m_generalPanel, wxID_ANY, _("Components"), wxDefaultPosition, wxDefaultSize, 0 );
componentsLabel->Wrap( -1 );
bSizerComponents->Add( componentsLabel, 0, wxALL, 5 );
m_gridComponents = new wxGrid( generalPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
m_gridComponents = new wxGrid( m_generalPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
// Grid
m_gridComponents->CreateGrid( 5, 4 );
@ -74,11 +76,11 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx
bSizerPads = new wxBoxSizer( wxVERTICAL );
wxStaticText* padsLabel;
padsLabel = new wxStaticText( generalPanel, wxID_ANY, _("Pads"), wxDefaultPosition, wxDefaultSize, 0 );
padsLabel = new wxStaticText( m_generalPanel, wxID_ANY, _("Pads"), wxDefaultPosition, wxDefaultSize, 0 );
padsLabel->Wrap( -1 );
bSizerPads->Add( padsLabel, 0, wxALL, 5 );
m_gridPads = new wxGrid( generalPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
m_gridPads = new wxGrid( m_generalPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
// Grid
m_gridPads->CreateGrid( 5, 2 );
@ -114,11 +116,11 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx
bSizerBrdSize = new wxBoxSizer( wxVERTICAL );
wxStaticText* boardLabel;
boardLabel = new wxStaticText( generalPanel, wxID_ANY, _("Board Size"), wxDefaultPosition, wxDefaultSize, 0 );
boardLabel = new wxStaticText( m_generalPanel, wxID_ANY, _("Board Size"), wxDefaultPosition, wxDefaultSize, 0 );
boardLabel->Wrap( -1 );
bSizerBrdSize->Add( boardLabel, 0, wxALL, 5 );
m_gridBoard = new wxGrid( generalPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
m_gridBoard = new wxGrid( m_generalPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
// Grid
m_gridBoard->CreateGrid( 3, 2 );
@ -153,11 +155,11 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx
wxBoxSizer* bSizerVias;
bSizerVias = new wxBoxSizer( wxVERTICAL );
viasLabel = new wxStaticText( generalPanel, wxID_ANY, _("Vias"), wxDefaultPosition, wxDefaultSize, 0 );
viasLabel = new wxStaticText( m_generalPanel, wxID_ANY, _("Vias"), wxDefaultPosition, wxDefaultSize, 0 );
viasLabel->Wrap( -1 );
bSizerVias->Add( viasLabel, 0, wxALL, 5 );
m_gridVias = new wxGrid( generalPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
m_gridVias = new wxGrid( m_generalPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
// Grid
m_gridVias->CreateGrid( 4, 2 );
@ -195,38 +197,38 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx
wxGridSizer* gOptionsSizer;
gOptionsSizer = new wxGridSizer( 0, 2, 0, 0 );
m_checkBoxSubtractHoles = new wxCheckBox( generalPanel, wxID_ANY, _("Subtract holes from board area"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxSubtractHoles = new wxCheckBox( m_generalPanel, wxID_ANY, _("Subtract holes from board area"), wxDefaultPosition, wxDefaultSize, 0 );
gOptionsSizer->Add( m_checkBoxSubtractHoles, 0, wxALL|wxEXPAND, 5 );
m_checkBoxExcludeComponentsNoPins = new wxCheckBox( generalPanel, wxID_ANY, _("Exclude components with no pins"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxExcludeComponentsNoPins = new wxCheckBox( m_generalPanel, wxID_ANY, _("Exclude components with no pins"), wxDefaultPosition, wxDefaultSize, 0 );
gOptionsSizer->Add( m_checkBoxExcludeComponentsNoPins, 0, wxALL|wxEXPAND, 5 );
bGeneralPanelSizer->Add( gOptionsSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
generalPanel->SetSizer( bGeneralPanelSizer );
generalPanel->Layout();
bGeneralPanelSizer->Fit( generalPanel );
topNotebook->AddPage( generalPanel, _("General"), true );
drillsPanel = new wxPanel( topNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_generalPanel->SetSizer( bGeneralPanelSizer );
m_generalPanel->Layout();
bGeneralPanelSizer->Fit( m_generalPanel );
topNotebook->AddPage( m_generalPanel, _("General"), true );
m_drillsPanel = new wxPanel( topNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bDrillsSizer;
bDrillsSizer = new wxBoxSizer( wxVERTICAL );
m_gridDrills = new wxGrid( drillsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
m_gridDrills = new WX_GRID( m_drillsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
// Grid
m_gridDrills->CreateGrid( 0, 8 );
m_gridDrills->EnableEditing( false );
m_gridDrills->EnableGridLines( true );
m_gridDrills->EnableDragGridSize( true );
m_gridDrills->EnableDragGridSize( false );
m_gridDrills->SetMargins( 0, 0 );
// Columns
m_gridDrills->AutoSizeColumns();
m_gridDrills->EnableDragColMove( true );
m_gridDrills->EnableDragColSize( true );
m_gridDrills->SetColLabelSize( 20 );
m_gridDrills->SetColLabelSize( 22 );
m_gridDrills->SetColLabelValue( 0, _("Count") );
m_gridDrills->SetColLabelValue( 1, _("Shape") );
m_gridDrills->SetColLabelValue( 2, _("X Size") );
@ -238,7 +240,7 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx
m_gridDrills->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_gridDrills->EnableDragRowSize( true );
m_gridDrills->EnableDragRowSize( false );
m_gridDrills->SetRowLabelSize( 0 );
m_gridDrills->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
@ -247,17 +249,15 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx
// Cell Defaults
m_gridDrills->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_TOP );
m_gridDrills->SetMaxSize( wxSize( -1,300 ) );
bDrillsSizer->Add( m_gridDrills, 1, wxALL|wxEXPAND, 5 );
drillsPanel->SetSizer( bDrillsSizer );
drillsPanel->Layout();
bDrillsSizer->Fit( drillsPanel );
topNotebook->AddPage( drillsPanel, _("Drill Holes"), false );
m_drillsPanel->SetSizer( bDrillsSizer );
m_drillsPanel->Layout();
bDrillsSizer->Fit( m_drillsPanel );
topNotebook->AddPage( m_drillsPanel, _("Drill Holes"), false );
bMainBoxSizer->Add( topNotebook, 1, wxEXPAND | wxALL, 5 );
bMainBoxSizer->Add( topNotebook, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerBottom;
bSizerBottom = new wxBoxSizer( wxHORIZONTAL );

View File

@ -61,7 +61,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxNotebook" expanded="1">
<property name="BottomDockable">1</property>
@ -116,11 +116,11 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<object class="notebookpage" expanded="0">
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">General</property>
<property name="select">1</property>
<object class="wxPanel" expanded="0">
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -155,7 +155,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">generalPanel</property>
<property name="name">m_generalPanel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -171,16 +171,16 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bGeneralPanelSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="0">
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">2</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">0,1</property>
@ -672,11 +672,11 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerVias</property>
<property name="orient">wxVERTICAL</property>
@ -981,11 +981,11 @@
</object>
</object>
</object>
<object class="notebookpage" expanded="0">
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Drill Holes</property>
<property name="select">0</property>
<object class="wxPanel" expanded="0">
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -1020,7 +1020,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">drillsPanel</property>
<property name="name">m_drillsPanel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -1036,7 +1036,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bDrillsSizer</property>
<property name="orient">wxVERTICAL</property>
@ -1068,7 +1068,7 @@
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="col_label_size">20</property>
<property name="col_label_size">22</property>
<property name="col_label_values">&quot;Count&quot; &quot;Shape&quot; &quot;X Size&quot; &quot;Y Size&quot; &quot;Plated&quot; &quot;Via/Pad&quot; &quot;Start Layer&quot; &quot;Stop Layer&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">8</property>
@ -1081,8 +1081,8 @@
<property name="docking">Left</property>
<property name="drag_col_move">1</property>
<property name="drag_col_size">1</property>
<property name="drag_grid_size">1</property>
<property name="drag_row_size">1</property>
<property name="drag_grid_size">0</property>
<property name="drag_row_size">0</property>
<property name="editing">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
@ -1100,7 +1100,7 @@
<property name="margin_width">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size">-1,300</property>
<property name="maximum_size">-1,-1</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
@ -1121,7 +1121,7 @@
<property name="rows">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; ; forward_declare</property>
<property name="subclass">WX_GRID; widgets/wx_grid.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
@ -1135,11 +1135,11 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerBottom</property>
<property name="orient">wxHORIZONTAL</property>

View File

@ -10,6 +10,8 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class WX_GRID;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
@ -40,7 +42,7 @@ class DIALOG_BOARD_STATISTICS_BASE : public DIALOG_SHIM
protected:
wxNotebook* topNotebook;
wxPanel* generalPanel;
wxPanel* m_generalPanel;
wxGrid* m_gridComponents;
wxGrid* m_gridPads;
wxGrid* m_gridBoard;
@ -48,8 +50,8 @@ class DIALOG_BOARD_STATISTICS_BASE : public DIALOG_SHIM
wxGrid* m_gridVias;
wxCheckBox* m_checkBoxSubtractHoles;
wxCheckBox* m_checkBoxExcludeComponentsNoPins;
wxPanel* drillsPanel;
wxGrid* m_gridDrills;
wxPanel* m_drillsPanel;
WX_GRID* m_gridDrills;
wxButton* m_buttonSaveReport;
wxStdDialogButtonSizer* m_sdbControlSizer;
wxButton* m_sdbControlSizerCancel;