From c16f85bd4d2769a4c406de3cc8fca6aba1212769 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 25 Apr 2021 20:08:05 +0100 Subject: [PATCH] Simplify after recent changes by adding DoSetDigitsAndUpdate() There is no need for a separate UpdateAfterDigitsChange(), it is always called together with DoSetDigits(). --- include/wx/generic/spinctlg.h | 6 +++--- src/generic/spinctlg.cpp | 14 +++++--------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/include/wx/generic/spinctlg.h b/include/wx/generic/spinctlg.h index b931f3457c..b25f8108c8 100644 --- a/include/wx/generic/spinctlg.h +++ b/include/wx/generic/spinctlg.h @@ -430,11 +430,11 @@ private: // specified increment without loss of precision. static unsigned DetermineDigits(double inc); - // Set the number of digits and the format unconditionally. + // Just set the number of digits and the format unconditionally. void DoSetDigits(unsigned digits); - // Update the appearance after the number of digits has changed. - void UpdateAfterDigitsChange(); + // Call DoSetDigits() and update the appearance. + void DoSetDigitsAndUpdate(unsigned digits); wxString m_format; diff --git a/src/generic/spinctlg.cpp b/src/generic/spinctlg.cpp index 830f64f6f0..da85d8fdae 100644 --- a/src/generic/spinctlg.cpp +++ b/src/generic/spinctlg.cpp @@ -759,11 +759,7 @@ void wxSpinCtrlDouble::SetIncrement(double inc) // could be undesirable, but we do increase it if the current number is not // high enough to show the numbers without losing precision. if ( digits > m_digits ) - { - DoSetDigits(digits); - - UpdateAfterDigitsChange(); - } + DoSetDigitsAndUpdate(digits); } void wxSpinCtrlDouble::SetDigits(unsigned digits) @@ -773,13 +769,13 @@ void wxSpinCtrlDouble::SetDigits(unsigned digits) if ( digits == m_digits ) return; - DoSetDigits(digits); - - UpdateAfterDigitsChange(); + DoSetDigitsAndUpdate(digits); } -void wxSpinCtrlDouble::UpdateAfterDigitsChange() +void wxSpinCtrlDouble::DoSetDigitsAndUpdate(unsigned digits) { + DoSetDigits(digits); + ResetTextValidator(); m_textCtrl->InvalidateBestSize();