From 7632c0cf6f9b2f89ba25562e3118d1a29b29db93 Mon Sep 17 00:00:00 2001 From: Mikolaj Wielgus Date: Tue, 15 Feb 2022 01:39:58 +0100 Subject: [PATCH] Fix board statistics drill grid column sizing And remove the horizontal scrollbar. --- pcbnew/dialogs/dialog_board_statistics.cpp | 8 +++++++- pcbnew/dialogs/dialog_board_statistics_base.cpp | 8 ++++---- pcbnew/dialogs/dialog_board_statistics_base.fbp | 12 ++++++++---- pcbnew/dialogs/dialog_board_statistics_base.h | 5 +++-- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/pcbnew/dialogs/dialog_board_statistics.cpp b/pcbnew/dialogs/dialog_board_statistics.cpp index cd271284f9..636a6690c8 100644 --- a/pcbnew/dialogs/dialog_board_statistics.cpp +++ b/pcbnew/dialogs/dialog_board_statistics.cpp @@ -25,6 +25,7 @@ #include "dialog_board_statistics.h" #include "base_units.h" +#include #include #include #include @@ -179,8 +180,11 @@ bool DIALOG_BOARD_STATISTICS::TransferDataToWindow() refreshItemsTypes(); getDataFromPCB(); updateWidets(); + Layout(); m_drillsPanel->Layout(); + m_gridDrills->AutoSizeColumns(); + finishDialogSettings(); return true; } @@ -605,7 +609,9 @@ void DIALOG_BOARD_STATISTICS::printGridToStringAsTable( wxGrid* aGrid, wxString& void DIALOG_BOARD_STATISTICS::adjustDrillGridColumns() { - int newTotalWidth = m_gridDrills->GetClientSize().GetWidth(); + wxGridUpdateLocker deferRepaintsTillLeavingScope( m_gridDrills ); + + int newTotalWidth = KIPLATFORM::UI::GetUnobscuredSize( m_gridDrills ).x; int curTotalWidth = 0; // Find the total current width diff --git a/pcbnew/dialogs/dialog_board_statistics_base.cpp b/pcbnew/dialogs/dialog_board_statistics_base.cpp index e6e4520649..50af6447a7 100644 --- a/pcbnew/dialogs/dialog_board_statistics_base.cpp +++ b/pcbnew/dialogs/dialog_board_statistics_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 26 2018) +// C++ code generated with wxFormBuilder (version 3.10.0) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -215,7 +215,7 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx wxBoxSizer* bDrillsSizer; bDrillsSizer = new wxBoxSizer( wxVERTICAL ); - m_gridDrills = new WX_GRID( m_drillsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); + m_gridDrills = new WX_GRID( m_drillsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL ); // Grid m_gridDrills->CreateGrid( 0, 8 ); @@ -228,7 +228,6 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx m_gridDrills->AutoSizeColumns(); m_gridDrills->EnableDragColMove( true ); m_gridDrills->EnableDragColSize( true ); - m_gridDrills->SetColLabelSize( 22 ); m_gridDrills->SetColLabelValue( 0, _("Count") ); m_gridDrills->SetColLabelValue( 1, _("Shape") ); m_gridDrills->SetColLabelValue( 2, _("X Size") ); @@ -237,6 +236,7 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx m_gridDrills->SetColLabelValue( 5, _("Via/Pad") ); m_gridDrills->SetColLabelValue( 6, _("Start Layer") ); m_gridDrills->SetColLabelValue( 7, _("Stop Layer") ); + m_gridDrills->SetColLabelSize( 22 ); m_gridDrills->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); // Rows @@ -245,7 +245,7 @@ DIALOG_BOARD_STATISTICS_BASE::DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wx m_gridDrills->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); // Label Appearance - m_gridDrills->SetLabelFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) ); + m_gridDrills->SetLabelFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); // Cell Defaults m_gridDrills->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_TOP ); diff --git a/pcbnew/dialogs/dialog_board_statistics_base.fbp b/pcbnew/dialogs/dialog_board_statistics_base.fbp index cf7cdf8e73..bbbc421100 100644 --- a/pcbnew/dialogs/dialog_board_statistics_base.fbp +++ b/pcbnew/dialogs/dialog_board_statistics_base.fbp @@ -1,6 +1,6 @@ - + ; C++ @@ -14,6 +14,7 @@ dialog_board_statistics_base 1000 none + 1 DIALOG_BOARD_STATISTCS_BASE @@ -25,6 +26,7 @@ 1 1 UI + 0 0 0 @@ -50,6 +52,7 @@ DIALOG_SHIM; dialog_shim.h; forward_declare Board Statistics + 0 @@ -512,7 +515,7 @@ - + 5 wxEXPAND|wxRIGHT 1 @@ -1094,7 +1097,7 @@ 0 wxID_ANY - ,90,90,-1,70,0 + ,90,92,-1,70,0 0 0 @@ -1126,7 +1129,7 @@ - wxHSCROLL|wxVSCROLL + wxVSCROLL drillGridSize @@ -1157,6 +1160,7 @@ + 0 diff --git a/pcbnew/dialogs/dialog_board_statistics_base.h b/pcbnew/dialogs/dialog_board_statistics_base.h index 77ea901e56..0fc5205ee3 100644 --- a/pcbnew/dialogs/dialog_board_statistics_base.h +++ b/pcbnew/dialogs/dialog_board_statistics_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 26 2018) +// C++ code generated with wxFormBuilder (version 3.10.0) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -56,7 +56,7 @@ class DIALOG_BOARD_STATISTICS_BASE : public DIALOG_SHIM wxStdDialogButtonSizer* m_sdbControlSizer; wxButton* m_sdbControlSizerCancel; - // Virtual event handlers, overide them in your derived class + // Virtual event handlers, override them in your derived class virtual void windowSize( wxSizeEvent& event ) { event.Skip(); } virtual void checkboxClicked( wxCommandEvent& event ) { event.Skip(); } virtual void drillGridSize( wxSizeEvent& event ) { event.Skip(); } @@ -66,6 +66,7 @@ class DIALOG_BOARD_STATISTICS_BASE : public DIALOG_SHIM public: DIALOG_BOARD_STATISTICS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Board Statistics"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_BOARD_STATISTICS_BASE(); };