PANEL_SETUP_BOARD_STACKUP: Do not limit the EpsilonR mantissa to 1 or 2 digits.

Fixes #8956
https://gitlab.com/kicad/code/kicad/issues/8956
This commit is contained in:
jean-pierre charras 2021-08-14 09:42:05 +02:00
parent 9aa9857685
commit 3d61c8b0c4
4 changed files with 17 additions and 17 deletions

View File

@ -28,6 +28,7 @@
#include <board.h> #include <board.h>
#include <i18n_utility.h> // For _HKI definition #include <i18n_utility.h> // For _HKI definition
#include "stackup_predefined_prms.h" #include "stackup_predefined_prms.h"
#include <string_utils.h> // for Double2Str()
BOARD_STACKUP_ITEM::BOARD_STACKUP_ITEM( BOARD_STACKUP_ITEM_TYPE aType ) BOARD_STACKUP_ITEM::BOARD_STACKUP_ITEM( BOARD_STACKUP_ITEM_TYPE aType )
@ -284,8 +285,8 @@ bool BOARD_STACKUP_ITEM::IsThicknessEditable() const
wxString BOARD_STACKUP_ITEM::FormatEpsilonR( int aDielectricSubLayer ) const wxString BOARD_STACKUP_ITEM::FormatEpsilonR( int aDielectricSubLayer ) const
{ {
// return a wxString to print/display Epsilon R // return a wxString to print/display Epsilon R
wxString txt; // note: we do not want scientific notation
txt.Printf( "%.2f", GetEpsilonR( aDielectricSubLayer ) ); wxString txt = Double2Str( GetEpsilonR( aDielectricSubLayer ) );
return txt; return txt;
} }
@ -293,8 +294,8 @@ wxString BOARD_STACKUP_ITEM::FormatEpsilonR( int aDielectricSubLayer ) const
wxString BOARD_STACKUP_ITEM::FormatLossTangent( int aDielectricSubLayer ) const wxString BOARD_STACKUP_ITEM::FormatLossTangent( int aDielectricSubLayer ) const
{ {
// return a wxString to print/display Loss Tangent // return a wxString to print/display Loss Tangent
wxString txt; // note: we do not want scientific notation
txt.Printf( "%g", GetLossTangent( aDielectricSubLayer ) ); wxString txt = Double2Str( GetLossTangent( aDielectricSubLayer ) );
return txt; return txt;
} }

View File

@ -27,6 +27,7 @@ DIALOG_DIELECTRIC_MATERIAL::DIALOG_DIELECTRIC_MATERIAL( wxWindow* aParent,
m_materialList( aMaterialList ) m_materialList( aMaterialList )
{ {
initMaterialList(); initMaterialList();
m_sdbSizerOK->SetDefault();
} }
DIALOG_DIELECTRIC_MATERIAL::~DIALOG_DIELECTRIC_MATERIAL() DIALOG_DIELECTRIC_MATERIAL::~DIALOG_DIELECTRIC_MATERIAL()

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2009-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2009-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -30,6 +30,7 @@
#include "stackup_predefined_prms.h" #include "stackup_predefined_prms.h"
#include "dielectric_material.h" #include "dielectric_material.h"
#include <core/arraydim.h> #include <core/arraydim.h>
#include <string_utils.h> // for Double2Str()
// A list of available substrate material // A list of available substrate material
@ -71,8 +72,8 @@ static DIELECTRIC_SUBSTRATE silkscreenMaterial[] =
wxString DIELECTRIC_SUBSTRATE::FormatEpsilonR() wxString DIELECTRIC_SUBSTRATE::FormatEpsilonR()
{ {
// return a wxString to print/display Epsilon R // return a wxString to print/display Epsilon R
wxString txt; // note: we do not want scientific notation
txt.Printf( "%.1f", m_EpsilonR ); wxString txt = Double2Str( m_EpsilonR );
return txt; return txt;
} }
@ -80,8 +81,8 @@ wxString DIELECTRIC_SUBSTRATE::FormatEpsilonR()
wxString DIELECTRIC_SUBSTRATE::FormatLossTangent() wxString DIELECTRIC_SUBSTRATE::FormatLossTangent()
{ {
// return a wxString to print/display Loss Tangent // return a wxString to print/display Loss Tangent
wxString txt; // note: we do not want scientific notation
txt.Printf( "%g", m_LossTangent ); wxString txt = Double2Str( m_LossTangent );
return txt; return txt;
} }

View File

@ -48,6 +48,7 @@
#include <locale_io.h> #include <locale_io.h>
#include <eda_list_dialog.h> #include <eda_list_dialog.h>
#include <string_utils.h> // for Double2Str()
// Some wx widget ID to know what widget has fired a event: // Some wx widget ID to know what widget has fired a event:
@ -564,8 +565,7 @@ void PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard( bool aFullSync )
if( item->HasEpsilonRValue() ) if( item->HasEpsilonRValue() )
{ {
wxString txt; wxString txt = Double2Str( item->GetEpsilonR( sub_item ) );
txt.Printf( "%.2f", item->GetEpsilonR( sub_item ) );
wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( ui_row_item.m_EpsilonCtrl ); wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( ui_row_item.m_EpsilonCtrl );
if( textCtrl ) if( textCtrl )
@ -574,8 +574,7 @@ void PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard( bool aFullSync )
if( item->HasLossTangentValue() ) if( item->HasLossTangentValue() )
{ {
wxString txt; wxString txt = Double2Str( item->GetLossTangent( sub_item ) );
txt.Printf( "%g", item->GetLossTangent( sub_item ) );
wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( ui_row_item.m_LossTgCtrl ); wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( ui_row_item.m_LossTgCtrl );
if( textCtrl ) if( textCtrl )
@ -822,8 +821,7 @@ BOARD_STACKUP_ROW_UI_ITEM PANEL_SETUP_BOARD_STACKUP::createRowData( int aRow,
if( item->HasEpsilonRValue() ) if( item->HasEpsilonRValue() )
{ {
wxString txt; wxString txt = Double2Str( item->GetEpsilonR( aSublayerIdx ) );
txt.Printf( "%.2f", item->GetEpsilonR( aSublayerIdx ) );
wxTextCtrl* textCtrl = new wxTextCtrl( m_scGridWin, wxID_ANY, wxEmptyString, wxTextCtrl* textCtrl = new wxTextCtrl( m_scGridWin, wxID_ANY, wxEmptyString,
wxDefaultPosition, m_numericFieldsSize ); wxDefaultPosition, m_numericFieldsSize );
textCtrl->SetValue( txt ); textCtrl->SetValue( txt );
@ -837,8 +835,7 @@ BOARD_STACKUP_ROW_UI_ITEM PANEL_SETUP_BOARD_STACKUP::createRowData( int aRow,
if( item->HasLossTangentValue() ) if( item->HasLossTangentValue() )
{ {
wxString txt; wxString txt = Double2Str( item->GetLossTangent( aSublayerIdx ) );;
txt.Printf( "%g", item->GetLossTangent( aSublayerIdx ) );
wxTextCtrl* textCtrl = new wxTextCtrl( m_scGridWin, wxID_ANY, wxEmptyString, wxTextCtrl* textCtrl = new wxTextCtrl( m_scGridWin, wxID_ANY, wxEmptyString,
wxDefaultPosition, m_numericFieldsSize ); wxDefaultPosition, m_numericFieldsSize );
textCtrl->SetValue( txt ); textCtrl->SetValue( txt );