From 75141da53a7b34b10a0839298ba4814b86d4aecb Mon Sep 17 00:00:00 2001 From: Mathieu Pilato Date: Sun, 7 Jul 2024 12:20:03 +0200 Subject: [PATCH] Move default format inside SPICE_VALUE_FORMAT This ensures that the default format is the same, however the measurements are added --- eeschema/sim/simulator_frame_ui.cpp | 1 - eeschema/sim/spice_value.cpp | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/eeschema/sim/simulator_frame_ui.cpp b/eeschema/sim/simulator_frame_ui.cpp index a4b8239dd5..d998ccc7b5 100644 --- a/eeschema/sim/simulator_frame_ui.cpp +++ b/eeschema/sim/simulator_frame_ui.cpp @@ -1521,7 +1521,6 @@ void SIMULATOR_FRAME_UI::AddMeasurement( const wxString& aCmd ) } m_measurementsGrid->SetCellValue( row, COL_MEASUREMENT, aCmd ); - SetMeasureFormat( row, { 3, wxS( "~V" ) } ); UpdateMeasurement( row ); updateMeasurementsFromGrid(); diff --git a/eeschema/sim/spice_value.cpp b/eeschema/sim/spice_value.cpp index d93fd4231c..00ee6583e0 100644 --- a/eeschema/sim/spice_value.cpp +++ b/eeschema/sim/spice_value.cpp @@ -40,10 +40,18 @@ void SPICE_VALUE_FORMAT::FromString( const wxString& aString ) { - long val; - aString.Left( 1 ).ToLong( &val ); - Precision = (int) val; - Range = aString.Right( aString.Length() - 1 ); + if( aString.IsEmpty() ) + { + Precision = 3; + Range = wxS( "~V" ); + } + else + { + long val; + aString.Left( 1 ).ToLong( &val ); + Precision = (int) val; + Range = aString.Right( aString.Length() - 1 ); + } }