Properties: update evaluator locale when creating editors

This commit is contained in:
Jon Evans 2022-12-06 17:56:25 -05:00
parent 593dc9e8b6
commit ad8e5891d2
3 changed files with 11 additions and 2 deletions

View File

@ -46,8 +46,7 @@ namespace numEval
NUMERIC_EVALUATOR::NUMERIC_EVALUATOR( EDA_UNITS aUnits )
{
struct lconv* lc = localeconv();
m_localeDecimalSeparator = *lc->decimal_point;
LocaleChanged();
m_parseError = false;
m_parseFinished = false;
@ -93,6 +92,13 @@ void NUMERIC_EVALUATOR::SetDefaultUnits( EDA_UNITS aUnits )
}
void NUMERIC_EVALUATOR::LocaleChanged()
{
struct lconv* lc = localeconv();
m_localeDecimalSeparator = *lc->decimal_point;
}
void NUMERIC_EVALUATOR::parseError( const char* s )
{
m_parseError = true;

View File

@ -139,6 +139,7 @@ void UNIT_BINDER::SetUnits( EDA_UNITS aUnits )
m_units = aUnits;
m_eval.SetDefaultUnits( m_units );
m_eval.LocaleChanged(); // In case locale changed since last run
if( m_unitLabel )
m_unitLabel->SetLabel( EDA_UNIT_UTILS::GetLabel( m_units, m_dataType ) );

View File

@ -105,6 +105,8 @@ public:
void SetDefaultUnits( EDA_UNITS aUnits );
void LocaleChanged();
/* Used by the lemon parser */
void parseError(const char* s);
void parseOk();