From fed2049df54c80dd1f07c7a53cd5b7bc2cbd02a6 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 20 Jul 2022 08:43:06 +0200 Subject: [PATCH] pcb_calculator: fix a cosmetic issue in PANEL_WAVELENGTH. Fixes #12020 https://gitlab.com/kicad/code/kicad/issues/12020 --- .../calculator_panels/panel_wavelength.cpp | 7 +++++++ .../panel_wavelength_base.cpp | 18 ++++++++---------- .../panel_wavelength_base.fbp | 18 +++++++++--------- .../calculator_panels/panel_wavelength_base.h | 4 ++-- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/pcb_calculator/calculator_panels/panel_wavelength.cpp b/pcb_calculator/calculator_panels/panel_wavelength.cpp index 0f200edad8..64450da766 100644 --- a/pcb_calculator/calculator_panels/panel_wavelength.cpp +++ b/pcb_calculator/calculator_panels/panel_wavelength.cpp @@ -24,6 +24,7 @@ #include #include "pcb_calculator_utils.h" #include "common_data.h" +#include #define SPEED_LIGHT 299792458 @@ -31,6 +32,12 @@ PANEL_WAVELENGTH::PANEL_WAVELENGTH( wxWindow* parent, wxWindowID id, const wxPoi const wxSize& size, long style, const wxString& name ) : PANEL_WAVELENGTH_BASE( parent, id, pos, size, style, name ) { + // Set the min size of wxTextCtrls showing long values + wxString msg( wxT( "1.234567890E+99" ) ); + wxClientDC dc( m_speedCtrl ); + wxSize txt_size = dc.GetTextExtent( msg ); + m_speedCtrl->SetMinSize( txt_size ); + Layout(); } void PANEL_WAVELENGTH::SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg ) diff --git a/pcb_calculator/calculator_panels/panel_wavelength_base.cpp b/pcb_calculator/calculator_panels/panel_wavelength_base.cpp index b298685787..aa0188dfcd 100644 --- a/pcb_calculator/calculator_panels/panel_wavelength_base.cpp +++ b/pcb_calculator/calculator_panels/panel_wavelength_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1) +// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -41,7 +41,7 @@ PANEL_WAVELENGTH_BASE::PANEL_WAVELENGTH_BASE( wxWindow* parent, wxWindowID id, c fgSizer3->Add( m_staticText181, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); m_periodCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer3->Add( m_periodCtrl, 0, wxALL, 5 ); + fgSizer3->Add( m_periodCtrl, 0, wxALL|wxEXPAND, 5 ); wxArrayString m_periodUnitChoices; m_periodUnit = new UNIT_SELECTOR_TIME( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_periodUnitChoices, 0 ); @@ -53,7 +53,7 @@ PANEL_WAVELENGTH_BASE::PANEL_WAVELENGTH_BASE( wxWindow* parent, wxWindowID id, c fgSizer3->Add( m_staticText1811, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); m_wavelengthVacuumCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer3->Add( m_wavelengthVacuumCtrl, 0, wxALL, 5 ); + fgSizer3->Add( m_wavelengthVacuumCtrl, 0, wxALL|wxEXPAND, 5 ); wxArrayString m_wavelengthVacuumUnitChoices; m_wavelengthVacuumUnit = new UNIT_SELECTOR_LEN_CABLE( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_wavelengthVacuumUnitChoices, 0 ); @@ -65,7 +65,7 @@ PANEL_WAVELENGTH_BASE::PANEL_WAVELENGTH_BASE( wxWindow* parent, wxWindowID id, c fgSizer3->Add( m_staticText18111, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); m_wavelengthMediumCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer3->Add( m_wavelengthMediumCtrl, 0, wxALL, 5 ); + fgSizer3->Add( m_wavelengthMediumCtrl, 0, wxALL|wxEXPAND, 5 ); wxArrayString m_wavelengthMediumUnitChoices; m_wavelengthMediumUnit = new UNIT_SELECTOR_LEN_CABLE( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_wavelengthMediumUnitChoices, 0 ); @@ -76,10 +76,8 @@ PANEL_WAVELENGTH_BASE::PANEL_WAVELENGTH_BASE( wxWindow* parent, wxWindowID id, c m_staticText181112->Wrap( -1 ); fgSizer3->Add( m_staticText181112, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); - m_speedCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_speedCtrl->Enable( false ); - - fgSizer3->Add( m_speedCtrl, 0, wxALL, 5 ); + m_speedCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); + fgSizer3->Add( m_speedCtrl, 0, wxALL|wxEXPAND, 5 ); wxArrayString m_speedUnitChoices; m_speedUnit = new UNIT_SELECTOR_SPEED( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_speedUnitChoices, 0 ); @@ -93,7 +91,7 @@ PANEL_WAVELENGTH_BASE::PANEL_WAVELENGTH_BASE( wxWindow* parent, wxWindowID id, c fgSizer3->Add( m_staticText181111, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); m_permittivityCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer3->Add( m_permittivityCtrl, 0, wxALL, 5 ); + fgSizer3->Add( m_permittivityCtrl, 0, wxALL|wxEXPAND, 5 ); m_button1 = new wxButton( this, wxID_ANY, _("..."), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer3->Add( m_button1, 0, wxALL, 5 ); @@ -105,7 +103,7 @@ PANEL_WAVELENGTH_BASE::PANEL_WAVELENGTH_BASE( wxWindow* parent, wxWindowID id, c fgSizer3->Add( m_staticText42, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); m_permeabilityCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer3->Add( m_permeabilityCtrl, 0, wxALL, 5 ); + fgSizer3->Add( m_permeabilityCtrl, 0, wxALL|wxEXPAND, 5 ); bSizer4->Add( fgSizer3, 1, wxEXPAND, 5 ); diff --git a/pcb_calculator/calculator_panels/panel_wavelength_base.fbp b/pcb_calculator/calculator_panels/panel_wavelength_base.fbp index e12a117ac3..0f936b1bcb 100644 --- a/pcb_calculator/calculator_panels/panel_wavelength_base.fbp +++ b/pcb_calculator/calculator_panels/panel_wavelength_base.fbp @@ -45,7 +45,7 @@ PANEL_WAVELENGTH_BASE - 736,453 + 538,453 CALCULATOR_PANEL; calculator_panels/calculator_panel.h; 0 @@ -336,7 +336,7 @@ 5 - wxALL + wxALL|wxEXPAND 0 1 @@ -527,7 +527,7 @@ 5 - wxALL + wxALL|wxEXPAND 0 1 @@ -718,7 +718,7 @@ 5 - wxALL + wxALL|wxEXPAND 0 1 @@ -909,7 +909,7 @@ 5 - wxALL + wxALL|wxEXPAND 0 1 @@ -932,7 +932,7 @@ Dock 0 Left - 0 + 1 1 @@ -957,7 +957,7 @@ Resizable 1 - + wxTE_READONLY ; ; forward_declare 0 @@ -1099,7 +1099,7 @@ 5 - wxALL + wxALL|wxEXPAND 0 1 @@ -1299,7 +1299,7 @@ 5 - wxALL + wxALL|wxEXPAND 0 1 diff --git a/pcb_calculator/calculator_panels/panel_wavelength_base.h b/pcb_calculator/calculator_panels/panel_wavelength_base.h index 4d3770b5bb..6a8e9c8219 100644 --- a/pcb_calculator/calculator_panels/panel_wavelength_base.h +++ b/pcb_calculator/calculator_panels/panel_wavelength_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1) +// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -76,7 +76,7 @@ class PANEL_WAVELENGTH_BASE : public CALCULATOR_PANEL public: - PANEL_WAVELENGTH_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 736,453 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + PANEL_WAVELENGTH_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 538,453 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); ~PANEL_WAVELENGTH_BASE();