Fix board statistics drill grid column sizing

And remove the horizontal scrollbar.
This commit is contained in:
Mikolaj Wielgus 2022-02-15 01:39:58 +01:00
parent 9c59c4ee12
commit 7632c0cf6f
4 changed files with 22 additions and 11 deletions

View File

@ -25,6 +25,7 @@
#include "dialog_board_statistics.h"
#include "base_units.h"
#include <kiplatform/ui.h>
#include <confirm.h>
#include <pad.h>
#include <macros.h>
@ -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

View File

@ -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 );

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="15" />
<FileVersion major="1" minor="16" />
<object class="Project" expanded="1">
<property name="class_decoration">; </property>
<property name="code_generation">C++</property>
@ -14,6 +14,7 @@
<property name="file">dialog_board_statistics_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">DIALOG_BOARD_STATISTCS_BASE</property>
@ -25,6 +26,7 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@ -50,6 +52,7 @@
<property name="subclass">DIALOG_SHIM; dialog_shim.h; forward_declare</property>
<property name="title">Board Statistics</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -512,7 +515,7 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT</property>
<property name="proportion">1</property>
@ -1094,7 +1097,7 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label_bg"></property>
<property name="label_font">,90,90,-1,70,0</property>
<property name="label_font">,90,92,-1,70,0</property>
<property name="label_text"></property>
<property name="margin_height">0</property>
<property name="margin_width">0</property>
@ -1126,7 +1129,7 @@
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxHSCROLL|wxVSCROLL</property>
<property name="window_style">wxVSCROLL</property>
<event name="OnSize">drillGridSize</event>
</object>
</object>
@ -1157,6 +1160,7 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>

View File

@ -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();
};