Clarity and Clang-tidy warnings.

This commit is contained in:
Jeff Young 2022-12-25 11:16:37 +00:00
parent fbaf4af489
commit 90edcc8c42
1 changed files with 11 additions and 3 deletions

View File

@ -164,14 +164,22 @@ void TUNER_SLIDER::updateComponentValue()
void TUNER_SLIDER::updateSlider()
{
wxASSERT( m_max >= m_value && m_value >= m_min );
m_slider->SetValue( ( ( m_value - m_min ) / ( m_max - m_min ) ).ToDouble() * 100 );
SPICE_VALUE value = ( m_value - m_min ) / ( m_max - m_min );
m_slider->SetValue( KiROUND( value.ToDouble() * 100.0 ) );
}
void TUNER_SLIDER::updateValueText()
{
bool spiceString = m_min.IsSpiceString() || m_max.IsSpiceString();
m_valueText->SetValue( spiceString ? m_value.ToSpiceString() : m_value.ToString() );
if( m_min.IsSpiceString() || m_max.IsSpiceString() )
{
m_valueText->SetValue( m_value.ToSpiceString() );
return;
}
double value = m_value.ToDouble();
m_valueText->SetValue( wxString::Format( "%.3f", value ) );
}