From be4c89011c6a81e9f6a4316f3370fe5ef543ee95 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 17 Sep 2023 12:41:41 +0100 Subject: [PATCH] Don't confuse "significant digits" with "decimal places". Also raises the default significant digits for cursors to 3. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15669 --- eeschema/dialogs/dialog_sim_format_value_base.cpp | 4 ++-- eeschema/dialogs/dialog_sim_format_value_base.fbp | 4 ++-- eeschema/sim/simulator_frame_ui.cpp | 4 ++-- eeschema/sim/spice_value.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/eeschema/dialogs/dialog_sim_format_value_base.cpp b/eeschema/dialogs/dialog_sim_format_value_base.cpp index 83e34d703f..535e4441a4 100644 --- a/eeschema/dialogs/dialog_sim_format_value_base.cpp +++ b/eeschema/dialogs/dialog_sim_format_value_base.cpp @@ -22,11 +22,11 @@ DIALOG_SIM_FORMAT_VALUE_BASE::DIALOG_SIM_FORMAT_VALUE_BASE( wxWindow* parent, wx fgSizer->SetFlexibleDirection( wxBOTH ); fgSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_precisionLabel = new wxStaticText( this, wxID_ANY, _("Precision:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_precisionLabel = new wxStaticText( this, wxID_ANY, _("Significant digits:"), wxDefaultPosition, wxDefaultSize, 0 ); m_precisionLabel->Wrap( -1 ); fgSizer->Add( m_precisionLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - m_precisionCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 9, 2 ); + m_precisionCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 9, 3 ); fgSizer->Add( m_precisionCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_rangeLabel = new wxStaticText( this, wxID_ANY, _("Range:"), wxDefaultPosition, wxDefaultSize, 0 ); diff --git a/eeschema/dialogs/dialog_sim_format_value_base.fbp b/eeschema/dialogs/dialog_sim_format_value_base.fbp index 0b04f433b8..f03f36629e 100644 --- a/eeschema/dialogs/dialog_sim_format_value_base.fbp +++ b/eeschema/dialogs/dialog_sim_format_value_base.fbp @@ -109,7 +109,7 @@ 0 0 wxID_ANY - Precision: + Significant digits: 0 0 @@ -170,7 +170,7 @@ 0 0 wxID_ANY - 2 + 3 9 0 diff --git a/eeschema/sim/simulator_frame_ui.cpp b/eeschema/sim/simulator_frame_ui.cpp index 57a64206bd..47419d5e1a 100644 --- a/eeschema/sim/simulator_frame_ui.cpp +++ b/eeschema/sim/simulator_frame_ui.cpp @@ -527,8 +527,8 @@ SIMULATOR_FRAME_UI::SIMULATOR_FRAME_UI( SIMULATOR_FRAME* aSimulatorFrame, for( int cursorId = 0; cursorId < 3; ++cursorId ) { - m_cursorFormats[ cursorId ][ 0 ] = { 2, wxS( "~s" ) }; - m_cursorFormats[ cursorId ][ 1 ] = { 2, wxS( "~V" ) }; + m_cursorFormats[ cursorId ][ 0 ] = { 3, wxS( "~s" ) }; + m_cursorFormats[ cursorId ][ 1 ] = { 3, wxS( "~V" ) }; } attr = new wxGridCellAttr; diff --git a/eeschema/sim/spice_value.cpp b/eeschema/sim/spice_value.cpp index 344106f9f4..44a8cde121 100644 --- a/eeschema/sim/spice_value.cpp +++ b/eeschema/sim/spice_value.cpp @@ -253,7 +253,7 @@ wxString SPICE_VALUE::ToString( const SPICE_VALUE_FORMAT& aFormat ) mantissa = KiROUND( mantissa * std::pow( 10, aFormat.Precision - 1 ) ); mantissa *= std::pow( 10, scale - aFormat.Precision + 1 ); - wxString res = wxString::FromCDouble( mantissa, aFormat.Precision ); + wxString res = wxString::FromCDouble( mantissa, std::max( 0, aFormat.Precision - scale - 1 ) ); return res + range; }