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
This commit is contained in:
parent
c80eb44900
commit
be4c89011c
|
@ -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 );
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Precision:</property>
|
||||
<property name="label">Significant digits:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
|
@ -170,7 +170,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="initial">2</property>
|
||||
<property name="initial">3</property>
|
||||
<property name="max">9</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue